Socket
Socket
Sign inDemoInstall

cronofy-elements

Package Overview
Dependencies
Maintainers
3
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cronofy-elements - npm Package Compare versions

Comparing version 1.35.4 to 1.36.0

build/CronofyElements.v1.36.0.js

8

package.json
{
"name": "cronofy-elements",
"version": "1.35.4",
"version": "1.36.0",
"description": "Fast track scheduling with Cronofy's embeddable UI Elements",

@@ -40,3 +40,6 @@ "main": "build/npm/CronofyElements.js",

"^.+\\.(css|less|scss)$": "babel-jest"
}
},
"snapshotSerializers": [
"@emotion/jest/serializer"
]
},

@@ -55,2 +58,3 @@ "author": "",

"@emotion/core": "^10.1.1",
"@emotion/jest": "^11.3.0",
"@testing-library/jest-dom": "^5.11.8",

@@ -57,0 +61,0 @@ "@testing-library/react": "^11.2.2",

@@ -9,7 +9,7 @@ import React, { useContext } from "react";

const theme = useContext(ThemeContext);
const [status, setStatus] = useContext(StatusContext);
const [status, dispatchStatus] = useContext(StatusContext);
const i18n = useContext(I18nContext);
const handleAddToggle = () => {
setStatus({ ...status, adding: !status.adding });
dispatchStatus({ type: "TOGGLE_ADD_PROFILE" });
};

@@ -16,0 +16,0 @@

@@ -1,2 +0,2 @@

import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useReducer } from "react";
import { css } from "@emotion/core";

@@ -16,2 +16,3 @@

import LoadingSpinner from "../generic/LoadingSpinner";
import { statusReducer } from "./contexts/status-reducer";

@@ -36,3 +37,3 @@ export const AuthContext = React.createContext();

const [status, setStatus] = useState({
const [status, dispatchStatus] = useReducer(statusReducer, {
adding: false,

@@ -47,3 +48,6 @@ demo: options.demo || false,

singleProfile: options.single_profile,
type: false,
type: null,
callback: options.callback
? options.callback
: () => log.info("No `callback` option has been provided"),
});

@@ -65,3 +69,3 @@ const [i18n, setI18n] = useState(

const [theme, setTheme] = useState({
...parseStyleOptions(options.styles, "AvailabilityViewer"),
...parseStyleOptions(options.styles, "CalendarSync"),
sizes: {

@@ -72,20 +76,3 @@ labelWidth: 60,

const sendCallback = res => {
if (status.pendingNotification !== null) {
if (typeof options.callback === "function") {
options.callback({
notification: status.pendingNotification,
userinfo: res,
});
}
setStatus({ ...status, pendingNotification: null });
}
};
useEffect(() => {
if (status.reload === false) {
return;
}
const getUserInfoOrDispatchDefault = () => {
if (options.token) {

@@ -95,4 +82,2 @@ connections

.then(res => {
sendCallback(res);
if (res["cronofy.data"]) {

@@ -104,7 +89,5 @@ setProfiles(res["cronofy.data"].profiles);

setStatus({
...status,
type: res["cronofy.type"],
loading: false,
reload: false,
dispatchStatus({
type: "GET_USER_INFO_SUCCESS",
userInfo: res,
});

@@ -115,23 +98,28 @@ })

const errorOutput = {};
if (error.docsSlug) {
errorOutput.docsSlug = error.docsSlug;
}
log.error(errorMessage, errorOutput);
setStatus({
...status,
loading: false,
error: error,
reload: false,
dispatchStatus({
type: "GET_USER_INFO_ERROR",
error,
});
});
} else {
sendCallback(null);
dispatchStatus({ type: "NO_TOKEN_SUCCESS" });
}
};
setStatus({
...status,
loading: false,
reload: false,
});
useEffect(() => {
getUserInfoOrDispatchDefault();
}, [options.token]);
useEffect(() => {
if (status.pendingNotification) {
getUserInfoOrDispatchDefault();
}
}, [status.reload]);
}, [status.pendingNotification]);

@@ -166,3 +154,3 @@ return (

<ThemeContext.Provider value={theme}>
<StatusContext.Provider value={[status, setStatus]}>
<StatusContext.Provider value={[status, dispatchStatus]}>
<span

@@ -169,0 +157,0 @@ css={css`

@@ -8,3 +8,3 @@ import React, { useContext } from "react";

const EditToggle = () => {
const [status, setStatus] = useContext(StatusContext);
const [status, dispatchStatus] = useContext(StatusContext);
const theme = useContext(ThemeContext);

@@ -14,3 +14,3 @@ const i18n = useContext(I18nContext);

const handleEditToggle = () => {
setStatus({ ...status, editing: !status.editing });
dispatchStatus({ type: "TOGGLE_EDIT_PROFILES" });
};

@@ -17,0 +17,0 @@

@@ -10,3 +10,3 @@ import React, { useContext } from "react";

const theme = useContext(ThemeContext);
const [status, setStatus] = useContext(StatusContext);
const [status] = useContext(StatusContext);

@@ -13,0 +13,0 @@ return (

@@ -12,8 +12,14 @@ import React, { useContext } from "react";

const Profiles = ({ loading }) => {
const theme = useContext(ThemeContext);
const options = useContext(OptionsContext);
const [profiles, setProfiles] = useContext(ProfilesContext);
const theme = useContext(ThemeContext);
const [status, setStatus] = useContext(StatusContext);
const [status, dispatchStatus] = useContext(StatusContext);
const removeProfile = profile => {
dispatchStatus({ type: "REVOKE_PROFILE", profile });
if (options.config.revoke_mode === "callback_only") {
return;
}
return revokeProfile(

@@ -26,4 +32,3 @@ options.token,

).then(res => {
const callback = { type: "profile_revoked", profile: profile };
setStatus({ ...status, reload: true, pendingNotification: callback });
dispatchStatus({ type: "REVOKE_PROFILE_SUCCESS", profile });
return res;

@@ -30,0 +35,0 @@ });

@@ -10,3 +10,3 @@ import React, { useContext } from "react";

const theme = useContext(ThemeContext);
const [status, setStatus] = useContext(StatusContext);
const [status] = useContext(StatusContext);

@@ -13,0 +13,0 @@ const handleProviderLink = e => {

@@ -20,7 +20,7 @@ import React, { useState, useContext } from "react";

});
const i18n = useContext(I18nContext);
const log = useContext(LoggingContext);
const i18n = useContext(I18nContext);
const theme = useContext(ThemeContext);
const options = useContext(OptionsContext);
const [status, setStatus] = useContext(StatusContext);
const theme = useContext(ThemeContext);
const [status] = useContext(StatusContext);

@@ -32,3 +32,7 @@ const handleLinkClick = () => {

log.warn("Not removing profile because we're running in demo mode");
setTimeout(() => setProfileStatus({ ...status, loading: false }), 1000);
}
if (options.config.revoke_mode === "callback_only") {
removeProfile();
setProfileStatus({ ...status, loading: false });
} else {

@@ -35,0 +39,0 @@ removeProfile()

@@ -330,3 +330,3 @@ import * as mocks from "./mocks";

) => {
if (mock) return mocks.revokeProfile;
if (mock) return mocks.revokeProfile();

@@ -333,0 +333,0 @@ return fetch(`${api_domain}/v1/profiles/${profile_id}/revoke?et=${token}`, {

@@ -45,2 +45,17 @@ import { parseToken, parseTarget, parseConnectionDomains, parseTranslations } from "./init";

const revokeMode =
typeof config.revoke_mode === "undefined" ? "trigger_and_callback" : config.revoke_mode;
const validRevokeModes = ["trigger_and_callback", "callback_only"];
const validRevokeMode = validRevokeModes.includes(revokeMode);
if (!validRevokeMode) {
log.error(
`Please provide a valid 'config.revoke_mode'. '${revokeMode}' is not a supported value.`,
{
docsSlug: "calendar-sync#config.revoke_mode",
}
);
return false;
}
options.single_profile =

@@ -63,3 +78,3 @@ typeof options.single_profile !== "undefined" ? options.single_profile : false;

...options,
config: { ...config, logs },
config: { ...config, logs, revoke_mode: revokeMode },
target,

@@ -66,0 +81,0 @@ token,

@@ -749,7 +749,12 @@ import moment from "moment-timezone";

export const revokeProfile = new Promise(function (resolve, reject) {
resolve({
status: 202,
export const revokeProfile = () =>
new Promise(resolve => {
setTimeout(
() =>
resolve({
status: 202,
}),
1000
);
});
});

@@ -756,0 +761,0 @@ export const queryForDateTimePicker = {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc