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.13.1 to 1.13.2

build/CronofyElements.v1.13.2.js

2

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

@@ -5,0 +5,0 @@ "main": "build/npm/CronofyElements.js",

@@ -95,2 +95,19 @@ import React, { useState, useEffect } from "react";

useEffect(() => {
if (!status.loading && !status.error) {
const newRules = buildNewRules(slots);
const callbackContent = {
notification: {
type: "availability_rule_edited"
},
availability_rule: {
...account,
calendar_ids: calendars.active,
weekly_periods: newRules
}
};
status.ruleSaved(callbackContent);
}
}, [calendars]);
useEffect(() => {
// Query the API for rules and calendars, but don't do anything until

@@ -293,8 +310,6 @@ // we've heard back from both.

) : (
<React.Fragment>
<CalendarContext.Provider
value={[calendars, setCalendars]}
>
<Calendars loading={status.loading} />
</CalendarContext.Provider>
<CalendarContext.Provider
value={[calendars, setCalendars]}
>
<Calendars loading={status.loading} />
<ExtrasContext.Provider

@@ -318,3 +333,3 @@ value={[extras, setExtras]}

</ExtrasContext.Provider>
</React.Fragment>
</CalendarContext.Provider>
)}

@@ -321,0 +336,0 @@ </StatusContext.Provider>

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

import React, { useContext } from "react";
import React, { useContext, useEffect, useRef } from "react";
import { css, jsx } from "@emotion/core";

@@ -13,3 +13,26 @@ import { transparentize } from "polished";

const [theme, setTheme] = useContext(ThemeContext);
const wrapperRef = useRef(null);
const handleEsc = e => {
if (e.keyCode === 27) {
done();
}
};
const handleClickOutside = e => {
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
done();
}
};
useEffect(() => {
document.addEventListener("click", handleClickOutside);
document.addEventListener("keydown", handleEsc);
return () => {
// Unbind the event listener on clean up
document.removeEventListener("click", handleClickOutside);
document.removeEventListener("keydown", handleEsc);
};
}, []);
const calendarsMarkup = calendars.all.map(cal => {

@@ -63,2 +86,3 @@ const isActive = calendars.active.includes(cal.id);

<div
ref={wrapperRef}
css={css`

@@ -65,0 +89,0 @@ position: absolute;

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

AccountContext,
CalendarContext,
SlotsContext,

@@ -20,2 +21,3 @@ StatusContext,

const account = useContext(AccountContext);
const [calendars, setCalendars] = useContext(CalendarContext);
const { slots, setSlots } = useContext(SlotsContext);

@@ -43,3 +45,7 @@ const [drag, setDrag] = useContext(DragContext);

},
availability_rule: { ...account, weekly_periods: newRules }
availability_rule: {
...account,
calendar_ids: calendars.active,
weekly_periods: newRules
}
};

@@ -46,0 +52,0 @@ status.ruleSaved(callbackContent);

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

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