@dev-crew-berlin/enter-js-utils 0.95.0 → 0.95.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221,6 +221,7 @@ export type components = {
221
221
  };
222
222
  companions?: components["schemas"]["RootModel_Union_Companion__MainGuest__-Input"];
223
223
  payment?: components["schemas"]["Payment"] | null;
224
+ partialPayment?: components["schemas"]["PartialPayment"];
224
225
  /** Branches */
225
226
  branches?: string[];
226
227
  /** Deletedbranches */
@@ -1246,13 +1247,34 @@ export type components = {
1246
1247
  */
1247
1248
  max: number;
1248
1249
  };
1250
+ /** PartialPayment */
1251
+ PartialPayment: {
1252
+ /** Paid */
1253
+ paid?: boolean;
1254
+ /** Amount */
1255
+ amount?: number;
1256
+ /**
1257
+ * Provider
1258
+ * @enum {string}
1259
+ */
1260
+ provider?: "manual" | "sepa" | "credit" | "bank_transfer" | "paypal" | "stripe";
1261
+ /**
1262
+ * Currency
1263
+ * @enum {string}
1264
+ */
1265
+ currency?: "USD" | "EUR" | "CHF";
1266
+ };
1249
1267
  /** Payment */
1250
1268
  Payment: {
1251
1269
  /** Paid */
1252
1270
  paid: boolean;
1253
1271
  /** Title */
1254
1272
  title?: string | null;
1255
- provider: components["schemas"]["PaymentProvider"];
1273
+ /**
1274
+ * Provider
1275
+ * @enum {string}
1276
+ */
1277
+ provider: "manual" | "sepa" | "credit" | "bank_transfer" | "paypal" | "stripe";
1256
1278
  /** Reference */
1257
1279
  reference?: string | null;
1258
1280
  /** Amount */
@@ -1288,10 +1310,9 @@ export type components = {
1288
1310
  attendeeId: string;
1289
1311
  /** Instancename */
1290
1312
  instanceName: string;
1291
- provider?: components["schemas"]["PaymentProvider"] | null;
1313
+ /** Provider */
1314
+ provider?: ("manual" | "sepa" | "credit" | "bank_transfer" | "paypal" | "stripe") | null;
1292
1315
  };
1293
- /** @enum {string} */
1294
- PaymentProvider: "manual" | "sepa" | "credit" | "bank_transfer" | "paypal" | "stripe";
1295
1316
  /** PublicAttendee */
1296
1317
  "PublicAttendee-Input": {
1297
1318
  /** Id */
@@ -97,7 +97,7 @@ export class Attendee {
97
97
  getResponse(branchName, counterName) {
98
98
  const rsvp = this.rsvp.get(branchName) ?? null;
99
99
  if (rsvp === null) return 'no-response';
100
- if (!rsvp.checkinCounters.has(counterName)) 'no-response';
100
+ if (!rsvp.checkinCounters.has(counterName)) return 'no-response';
101
101
  return rsvp.confirmed ? 'positive-response' : 'negative-response';
102
102
  }
103
103
  getCheckinsForBranch(branchName) {
@@ -45,7 +45,8 @@ export const GuestCard = props => {
45
45
  })), /*#__PURE__*/React.createElement("div", {
46
46
  className: _JSXStyle.dynamic([["1739379681", [colors.enterGrey, colors.enterBackground, fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'tag-list'
47
47
  }, tags.map(tag => /*#__PURE__*/React.createElement(Tag, {
48
- key: tag
48
+ key: tag,
49
+ color: getTagColor(tag)
49
50
  }, tag)), props.infoText && /*#__PURE__*/React.createElement("div", {
50
51
  className: _JSXStyle.dynamic([["1739379681", [colors.enterGrey, colors.enterBackground, fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'info'
51
52
  }, " ", props.infoText))), /*#__PURE__*/React.createElement(_JSXStyle, {
package/dist/ui/tag.d.ts CHANGED
@@ -2,6 +2,8 @@ import { FunctionComponent, ReactNode } from 'react';
2
2
  import 'styled-jsx';
3
3
  type Props = {
4
4
  children: ReactNode;
5
+ color?: string | null;
6
+ big?: boolean;
5
7
  };
6
8
  export declare const Tag: FunctionComponent<Props>;
7
9
  export {};
package/dist/ui/tag.js CHANGED
@@ -2,11 +2,21 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import React from 'react';
3
3
  import 'styled-jsx';
4
4
  import { colors, fonts } from '../lib/theme';
5
+
6
+ // Decide on text color based on contrast to background color
7
+ function getContrastYIQ(hexcolor) {
8
+ const r = parseInt(hexcolor.substring(1, 3), 16);
9
+ const g = parseInt(hexcolor.substring(3, 5), 16);
10
+ const b = parseInt(hexcolor.substring(5, 7), 16);
11
+ const yiq = (r * 299 + g * 587 + b * 114) / 1000;
12
+ return yiq >= 128 ? 'black' : 'white';
13
+ }
5
14
  export const Tag = props => {
15
+ const textColor = getContrastYIQ(props.color ?? '#ffffff');
6
16
  return /*#__PURE__*/React.createElement("div", {
7
- className: _JSXStyle.dynamic([["3070421237", [fonts.primary, colors.enterDarkGrey, colors.enterGrey]]]) + " " + 'tag'
17
+ className: _JSXStyle.dynamic([["2799826206", [fonts.primary, props.big ? '14px' : '0.8em', textColor === 'black' ? colors.enterDarkGrey : 'white', props.color ? props.color : 'transparent', colors.enterGrey, props.big ? '7px 10px 5px 0' : '0 0 0.5em 0.5em']]]) + " " + 'tag'
8
18
  }, props.children, /*#__PURE__*/React.createElement(_JSXStyle, {
9
- id: "3070421237",
10
- dynamic: [fonts.primary, colors.enterDarkGrey, colors.enterGrey]
11
- }, `.tag.__jsx-style-dynamic-selector{font-family:${fonts.primary};font-size:0.8em;color:${colors.enterDarkGrey};text-transform:uppercase;display:inline-block;background-color:transparent;border-radius:2px;border:1px solid ${colors.enterGrey};padding:2px 8px;margin:0 0 0.5em 0.5em;word-wrap:anywhere;}`));
19
+ id: "2799826206",
20
+ dynamic: [fonts.primary, props.big ? '14px' : '0.8em', textColor === 'black' ? colors.enterDarkGrey : 'white', props.color ? props.color : 'transparent', colors.enterGrey, props.big ? '7px 10px 5px 0' : '0 0 0.5em 0.5em']
21
+ }, `.tag.__jsx-style-dynamic-selector{font-family:${fonts.primary};font-size:${props.big ? '14px' : '0.8em'};color:${textColor === 'black' ? colors.enterDarkGrey : 'white'};text-transform:uppercase;display:inline-block;background-color:${props.color ? props.color : 'transparent'};border-radius:2px;border:1px solid ${colors.enterGrey};padding:2px 8px;margin:${props.big ? '7px 10px 5px 0' : '0 0 0.5em 0.5em'};word-wrap:anywhere;}`));
12
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.95.0",
3
+ "version": "0.95.1",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",