@planningcenter/organization-avatars 1.0.1 → 1.1.0

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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),B=require("react-dom"),D=require("@planningcenter/url"),N=require("@planningcenter/tapestry"),A=require("@planningcenter/icons/paths/general"),L=require("@planningcenter/icons/paths/services"),P=require("react-dropzone");function S(a){var o,r,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(o=0;o<c;o++)a[o]&&(r=S(a[o]))&&(t&&(t+=" "),t+=r)}else for(r in a)a[r]&&(t&&(t+=" "),t+=r);return t}function $(){for(var a,o,r=0,t="",c=arguments.length;r<c;r++)(a=arguments[r])&&(o=S(a))&&(t&&(t+=" "),t+=o);return t}const T=a=>a==="dark_mode_avatar"?"dark":"light";function z({avatarUrl:a,organization:o,mode:r,pcoApp:t,pcoEnv:c,csrfToken:f,onAvatarUpdate:x}){const[n,m]=i.useState(null),[d,v]=i.useState(a),[l,g]=i.useState(!1),[j,u]=i.useState(""),_=i.useId(),C=i.useRef(null),b=T(r),F=h=>{const[s]=h;s&&m(Object.assign(s,{preview:URL.createObjectURL(s)}))};i.useEffect(()=>{v(a)},[a]),i.useEffect(()=>()=>{n?.preview&&(URL.revokeObjectURL(n.preview),u(""))},[n]);const k=async h=>{const s=await fetch(D.pcoApiUrl(t,{env:c}),{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":f,Accept:"application/json"},body:JSON.stringify({data:{attributes:h}})}),p=await s.json();if(!s.ok)throw p;return p},q=async h=>{if(h.preventDefault(),!(!n||l)){g(!0);try{const s=new FileReader,p=await new Promise((w,U)=>{s.onloadend=()=>w(s.result),s.onerror=U,s.readAsDataURL(n)}),y=await k({[r]:p,[`${r}_cache`]:""});v(y.data.attributes[r].url),m(null),x(r,y.data.attributes[r].url),C.current?.close()}catch{u("We were unable to save your avatar.")}finally{g(!1)}}},M=async()=>{if(!l){g(!0);try{await k({[`remove_${r}`]:"1"}),v(""),x(r,""),C.current?.close()}catch{u("We were unable to delete your avatar.")}finally{g(!1)}}},O=()=>{m(null),u("")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatar",children:[e.jsx("button",{type:"button",commandfor:_,command:"show-modal",className:`pco-org-avatar__button pco-org-avatar__button--${b}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:d,alt:`Church logo for ${o}`}),e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:A.pencil})})})]}):e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:L.image})})}),e.jsxs("div",{className:"pco-org-avatar__label",children:[b," mode"]})]}),B.createPortal(e.jsx("dialog",{id:_,ref:C,className:"dialog",onClose:O,children:e.jsxs("form",{onSubmit:q,children:[e.jsxs("div",{className:"dialog__header",children:[e.jsxs("h1",{className:"dialog__title",children:["Church logo — ",b," mode"]}),e.jsx("button",{type:"button",commandfor:_,command:"close",className:"dialog__close","aria-label":"Close modal",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:A.smallX})})})]}),e.jsxs("div",{className:"dialog__body",children:[j&&e.jsxs("div",{role:"alert",className:"alert alert--danger mb-2",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",className:"symbol","aria-hidden":"true",children:e.jsx("path",{d:A.exclamationTriangle})}),e.jsx("div",{className:"alert__content",children:e.jsx("p",{children:j})})]}),e.jsx(P,{accept:{"image/*":[".jpg",".jpeg",".png"]},multiple:!1,onDropAccepted:F,children:({getRootProps:h,getInputProps:s,isFocused:p,isDragAccept:y,isDragReject:w,isDragActive:U})=>{const R=$("pco-org-avatar__dropzone",`pco-org-avatar__dropzone--${b}`,{"pco-org-avatar__dropzone--image":n||d,"pco-org-avatar__dropzone--focused":p,"pco-org-avatar__dropzone--accepted":y,"pco-org-avatar__dropzone--rejected":U&&w});return e.jsxs("div",{...h({className:R}),children:[e.jsx("input",{...s()}),n?e.jsx("img",{src:n.preview,alt:`Church logo for ${o}`}):d?e.jsx("img",{src:d,alt:`Church logo for ${o}`}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"64",height:"64",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:A.toCloudArrow})}),U&&w?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Wrong file type"}),e.jsx("p",{children:"Please upload a PNG or JPG file."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Add church logo"}),e.jsx("p",{children:"Use a high-quality image (up to 20mb) with a transparent background."})]})]})]})}})]}),e.jsxs("div",{className:"dialog__actions",children:[d&&e.jsx(N.Button,{label:"Delete logo",kind:"delete",onClick:M,loading:l,disabled:l,className:"mr-a"}),e.jsx(N.Button,{type:"button",label:"Cancel",commandfor:_,command:"close",disabled:l}),e.jsx(N.Button,{type:"submit",label:"Update logo",kind:"primary",loading:l,disabled:!n||l})]})]})}),document.body)]})}function I({avatarUrl:a,darkModeAvatarUrl:o,orgName:r,pcoApp:t,pcoEnv:c,csrfToken:f,showDarkModeAvatar:x=!1}){const[n,m]=i.useState(a),[d,v]=i.useState(o),l=(j,u)=>{j==="avatar"?m(u):j==="dark_mode_avatar"&&v(u)},g=d||n;return e.jsxs("div",{className:"d-f g-1",children:[e.jsx(z,{avatarUrl:n,organization:r,mode:"avatar",pcoApp:t,pcoEnv:c,csrfToken:f,onAvatarUpdate:l}),x&&e.jsx(z,{avatarUrl:g,organization:r,mode:"dark_mode_avatar",pcoApp:t,pcoEnv:c,csrfToken:f,onAvatarUpdate:l})]})}exports.OrganizationAvatars=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),R=require("react-dom"),B=require("@planningcenter/url"),C=require("@planningcenter/tapestry"),A=require("@planningcenter/icons/paths/general"),D=require("@planningcenter/icons/paths/services"),L=require("react-dropzone");function z(a){var o,r,t="";if(typeof a=="string"||typeof a=="number")t+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(o=0;o<c;o++)a[o]&&(r=z(a[o]))&&(t&&(t+=" "),t+=r)}else for(r in a)a[r]&&(t&&(t+=" "),t+=r);return t}function P(){for(var a,o,r=0,t="",c=arguments.length;r<c;r++)(a=arguments[r])&&(o=z(a))&&(t&&(t+=" "),t+=o);return t}const $=a=>a==="dark_mode_avatar"?"dark":"light";function k({avatarUrl:a,organization:o,mode:r,pcoEnv:t,csrfToken:c,onAvatarUpdate:f}){const[n,m]=i.useState(null),[d,v]=i.useState(a),[l,g]=i.useState(!1),[j,u]=i.useState(""),x=i.useId(),U=i.useRef(null),_=$(r),S=h=>{const[s]=h;s&&m(Object.assign(s,{preview:URL.createObjectURL(s)}))};i.useEffect(()=>{v(a)},[a]),i.useEffect(()=>()=>{n?.preview&&(URL.revokeObjectURL(n.preview),u(""))},[n]);const N=async h=>{const s=await fetch(B.pcoApiUrl("accounts",{env:t}),{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":c,Accept:"application/json"},body:JSON.stringify({data:{attributes:h}})}),p=await s.json();if(!s.ok)throw p;return p},F=async h=>{if(h.preventDefault(),!(!n||l)){g(!0);try{const s=new FileReader,p=await new Promise((y,w)=>{s.onloadend=()=>y(s.result),s.onerror=w,s.readAsDataURL(n)}),b=await N({[r]:p,[`${r}_cache`]:""});v(b.data.attributes[r].url),m(null),f(r,b.data.attributes[r].url),U.current?.close()}catch{u("We were unable to save your avatar.")}finally{g(!1)}}},q=async()=>{if(!l){g(!0);try{await N({[`remove_${r}`]:"1"}),v(""),f(r,""),U.current?.close()}catch{u("We were unable to delete your avatar.")}finally{g(!1)}}},M=()=>{m(null),u("")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatar",children:[e.jsx("button",{type:"button",commandfor:x,command:"show-modal",className:`pco-org-avatar__button pco-org-avatar__button--${_}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:d,alt:`Church logo for ${o}`}),e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:A.pencil})})})]}):e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:D.image})})}),e.jsxs("div",{className:"pco-org-avatar__label",children:[_," mode"]})]}),R.createPortal(e.jsx("dialog",{id:x,ref:U,className:"dialog",onClose:M,children:e.jsxs("form",{onSubmit:F,children:[e.jsxs("div",{className:"dialog__header",children:[e.jsxs("h1",{className:"dialog__title",children:["Church logo — ",_," mode"]}),e.jsx("button",{type:"button",commandfor:x,command:"close",className:"dialog__close","aria-label":"Close modal",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:A.smallX})})})]}),e.jsxs("div",{className:"dialog__body",children:[j&&e.jsxs("div",{role:"alert",className:"alert alert--danger mb-2",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",className:"symbol","aria-hidden":"true",children:e.jsx("path",{d:A.exclamationTriangle})}),e.jsx("div",{className:"alert__content",children:e.jsx("p",{children:j})})]}),e.jsx(L,{accept:{"image/*":[".jpg",".jpeg",".png"]},multiple:!1,onDropAccepted:S,children:({getRootProps:h,getInputProps:s,isFocused:p,isDragAccept:b,isDragReject:y,isDragActive:w})=>{const O=P("pco-org-avatar__dropzone",`pco-org-avatar__dropzone--${_}`,{"pco-org-avatar__dropzone--image":n||d,"pco-org-avatar__dropzone--focused":p,"pco-org-avatar__dropzone--accepted":b,"pco-org-avatar__dropzone--rejected":w&&y});return e.jsxs("div",{...h({className:O}),children:[e.jsx("input",{...s()}),n?e.jsx("img",{src:n.preview,alt:`Church logo for ${o}`}):d?e.jsx("img",{src:d,alt:`Church logo for ${o}`}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"64",height:"64",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:A.toCloudArrow})}),w&&y?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Wrong file type"}),e.jsx("p",{children:"Please upload a PNG or JPG file."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Add church logo"}),e.jsx("p",{children:"Use a high-quality image (up to 20mb) with a transparent background."})]})]})]})}})]}),e.jsxs("div",{className:"dialog__actions",children:[d&&e.jsx(C.Button,{label:"Delete logo",kind:"delete",onClick:q,loading:l,disabled:l,className:"mr-a"}),e.jsx(C.Button,{type:"button",label:"Cancel",commandfor:x,command:"close",disabled:l}),e.jsx(C.Button,{type:"submit",label:"Update logo",kind:"primary",loading:l,disabled:!n||l})]})]})}),document.body)]})}function T({avatarUrl:a,darkModeAvatarUrl:o,orgName:r,pcoEnv:t,csrfToken:c,showDarkModeAvatar:f=!1}){const[n,m]=i.useState(a),[d,v]=i.useState(o),l=(j,u)=>{j==="avatar"?m(u):j==="dark_mode_avatar"&&v(u)},g=d||n;return e.jsxs("div",{className:"d-f g-1",children:[e.jsx(k,{avatarUrl:n,organization:r,mode:"avatar",pcoEnv:t,csrfToken:c,onAvatarUpdate:l}),f&&e.jsx(k,{avatarUrl:g,organization:r,mode:"dark_mode_avatar",pcoEnv:t,csrfToken:c,onAvatarUpdate:l})]})}exports.OrganizationAvatars=T;
package/dist/index.js CHANGED
@@ -1,35 +1,34 @@
1
1
  import { jsxs as o, Fragment as b, jsx as e } from "react/jsx-runtime";
2
- import { useState as m, useId as P, useRef as S, useEffect as M } from "react";
3
- import { createPortal as I } from "react-dom";
4
- import { pcoApiUrl as T } from "@planningcenter/url";
5
- import { Button as j } from "@planningcenter/tapestry";
6
- import { pencil as W, smallX as G, exclamationTriangle as J, toCloudArrow as X } from "@planningcenter/icons/paths/general";
7
- import { image as q } from "@planningcenter/icons/paths/services";
8
- import E from "react-dropzone";
9
- function R(a) {
2
+ import { useState as m, useId as B, useRef as P, useEffect as x } from "react";
3
+ import { createPortal as S } from "react-dom";
4
+ import { pcoApiUrl as I } from "@planningcenter/url";
5
+ import { Button as z } from "@planningcenter/tapestry";
6
+ import { pencil as T, smallX as W, exclamationTriangle as G, toCloudArrow as J } from "@planningcenter/icons/paths/general";
7
+ import { image as X } from "@planningcenter/icons/paths/services";
8
+ import q from "react-dropzone";
9
+ function D(a) {
10
10
  var l, r, t = "";
11
11
  if (typeof a == "string" || typeof a == "number") t += a;
12
12
  else if (typeof a == "object") if (Array.isArray(a)) {
13
- var c = a.length;
14
- for (l = 0; l < c; l++) a[l] && (r = R(a[l])) && (t && (t += " "), t += r);
13
+ var d = a.length;
14
+ for (l = 0; l < d; l++) a[l] && (r = D(a[l])) && (t && (t += " "), t += r);
15
15
  } else for (r in a) a[r] && (t && (t += " "), t += r);
16
16
  return t;
17
17
  }
18
- function H() {
19
- for (var a, l, r = 0, t = "", c = arguments.length; r < c; r++) (a = arguments[r]) && (l = R(a)) && (t && (t += " "), t += l);
18
+ function E() {
19
+ for (var a, l, r = 0, t = "", d = arguments.length; r < d; r++) (a = arguments[r]) && (l = D(a)) && (t && (t += " "), t += l);
20
20
  return t;
21
21
  }
22
- const K = (a) => a === "dark_mode_avatar" ? "dark" : "light";
23
- function D({
22
+ const H = (a) => a === "dark_mode_avatar" ? "dark" : "light";
23
+ function M({
24
24
  avatarUrl: a,
25
25
  organization: l,
26
26
  mode: r,
27
- pcoApp: t,
28
- pcoEnv: c,
29
- csrfToken: y,
30
- onAvatarUpdate: w
27
+ pcoEnv: t,
28
+ csrfToken: d,
29
+ onAvatarUpdate: y
31
30
  }) {
32
- const [i, g] = m(null), [s, f] = m(a), [d, v] = m(!1), [_, h] = m(""), U = P(), z = S(null), C = K(r), F = (u) => {
31
+ const [i, g] = m(null), [s, f] = m(a), [c, v] = m(!1), [_, h] = m(""), w = B(), N = P(null), U = H(r), R = (u) => {
33
32
  const [n] = u;
34
33
  n && g(
35
34
  Object.assign(n, {
@@ -37,17 +36,17 @@ function D({
37
36
  })
38
37
  );
39
38
  };
40
- M(() => {
39
+ x(() => {
41
40
  f(a);
42
- }, [a]), M(() => () => {
41
+ }, [a]), x(() => () => {
43
42
  i?.preview && (URL.revokeObjectURL(i.preview), h(""));
44
43
  }, [i]);
45
- const x = async (u) => {
46
- const n = await fetch(T(t, { env: c }), {
44
+ const j = async (u) => {
45
+ const n = await fetch(I("accounts", { env: t }), {
47
46
  method: "PATCH",
48
47
  headers: {
49
48
  "Content-Type": "application/json",
50
- "X-CSRF-Token": y,
49
+ "X-CSRF-Token": d,
51
50
  Accept: "application/json"
52
51
  },
53
52
  body: JSON.stringify({
@@ -58,37 +57,37 @@ function D({
58
57
  }), p = await n.json();
59
58
  if (!n.ok) throw p;
60
59
  return p;
61
- }, L = async (u) => {
62
- if (u.preventDefault(), !(!i || d)) {
60
+ }, F = async (u) => {
61
+ if (u.preventDefault(), !(!i || c)) {
63
62
  v(!0);
64
63
  try {
65
- const n = new FileReader(), p = await new Promise((k, N) => {
66
- n.onloadend = () => k(n.result), n.onerror = N, n.readAsDataURL(i);
67
- }), A = await x({
64
+ const n = new FileReader(), p = await new Promise((C, k) => {
65
+ n.onloadend = () => C(n.result), n.onerror = k, n.readAsDataURL(i);
66
+ }), A = await j({
68
67
  [r]: p,
69
68
  [`${r}_cache`]: ""
70
69
  });
71
- f(A.data.attributes[r].url), g(null), w(r, A.data.attributes[r].url), z.current?.close();
70
+ f(A.data.attributes[r].url), g(null), y(r, A.data.attributes[r].url), N.current?.close();
72
71
  } catch {
73
72
  h("We were unable to save your avatar.");
74
73
  } finally {
75
74
  v(!1);
76
75
  }
77
76
  }
78
- }, O = async () => {
79
- if (!d) {
77
+ }, L = async () => {
78
+ if (!c) {
80
79
  v(!0);
81
80
  try {
82
- await x({
81
+ await j({
83
82
  [`remove_${r}`]: "1"
84
- }), f(""), w(r, ""), z.current?.close();
83
+ }), f(""), y(r, ""), N.current?.close();
85
84
  } catch {
86
85
  h("We were unable to delete your avatar.");
87
86
  } finally {
88
87
  v(!1);
89
88
  }
90
89
  }
91
- }, $ = () => {
90
+ }, O = () => {
92
91
  g(null), h("");
93
92
  };
94
93
  return /* @__PURE__ */ o(b, { children: [
@@ -97,9 +96,9 @@ function D({
97
96
  "button",
98
97
  {
99
98
  type: "button",
100
- commandfor: U,
99
+ commandfor: w,
101
100
  command: "show-modal",
102
- className: `pco-org-avatar__button pco-org-avatar__button--${C}`,
101
+ className: `pco-org-avatar__button pco-org-avatar__button--${U}`,
103
102
  children: s ? /* @__PURE__ */ o(b, { children: [
104
103
  /* @__PURE__ */ e("img", { src: s, alt: `Church logo for ${l}` }),
105
104
  /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
@@ -110,7 +109,7 @@ function D({
110
109
  viewBox: "0 0 16 16",
111
110
  fill: "currentColor",
112
111
  "aria-hidden": "true",
113
- children: /* @__PURE__ */ e("path", { d: W })
112
+ children: /* @__PURE__ */ e("path", { d: T })
114
113
  }
115
114
  ) })
116
115
  ] }) : /* @__PURE__ */ e(
@@ -121,36 +120,36 @@ function D({
121
120
  viewBox: "0 0 16 16",
122
121
  fill: "currentColor",
123
122
  "aria-hidden": "true",
124
- children: /* @__PURE__ */ e("path", { d: q })
123
+ children: /* @__PURE__ */ e("path", { d: X })
125
124
  }
126
125
  )
127
126
  }
128
127
  ),
129
128
  /* @__PURE__ */ o("div", { className: "pco-org-avatar__label", children: [
130
- C,
129
+ U,
131
130
  " mode"
132
131
  ] })
133
132
  ] }),
134
- I(
133
+ S(
135
134
  /* @__PURE__ */ e(
136
135
  "dialog",
137
136
  {
138
- id: U,
139
- ref: z,
137
+ id: w,
138
+ ref: N,
140
139
  className: "dialog",
141
- onClose: $,
142
- children: /* @__PURE__ */ o("form", { onSubmit: L, children: [
140
+ onClose: O,
141
+ children: /* @__PURE__ */ o("form", { onSubmit: F, children: [
143
142
  /* @__PURE__ */ o("div", { className: "dialog__header", children: [
144
143
  /* @__PURE__ */ o("h1", { className: "dialog__title", children: [
145
144
  "Church logo — ",
146
- C,
145
+ U,
147
146
  " mode"
148
147
  ] }),
149
148
  /* @__PURE__ */ e(
150
149
  "button",
151
150
  {
152
151
  type: "button",
153
- commandfor: U,
152
+ commandfor: w,
154
153
  command: "close",
155
154
  className: "dialog__close",
156
155
  "aria-label": "Close modal",
@@ -162,7 +161,7 @@ function D({
162
161
  viewBox: "0 0 16 16",
163
162
  fill: "currentColor",
164
163
  "aria-hidden": "true",
165
- children: /* @__PURE__ */ e("path", { d: G })
164
+ children: /* @__PURE__ */ e("path", { d: W })
166
165
  }
167
166
  )
168
167
  }
@@ -178,36 +177,36 @@ function D({
178
177
  viewBox: "0 0 16 16",
179
178
  className: "symbol",
180
179
  "aria-hidden": "true",
181
- children: /* @__PURE__ */ e("path", { d: J })
180
+ children: /* @__PURE__ */ e("path", { d: G })
182
181
  }
183
182
  ),
184
183
  /* @__PURE__ */ e("div", { className: "alert__content", children: /* @__PURE__ */ e("p", { children: _ }) })
185
184
  ] }),
186
185
  /* @__PURE__ */ e(
187
- E,
186
+ q,
188
187
  {
189
188
  accept: { "image/*": [".jpg", ".jpeg", ".png"] },
190
189
  multiple: !1,
191
- onDropAccepted: F,
190
+ onDropAccepted: R,
192
191
  children: ({
193
192
  getRootProps: u,
194
193
  getInputProps: n,
195
194
  isFocused: p,
196
195
  isDragAccept: A,
197
- isDragReject: k,
198
- isDragActive: N
196
+ isDragReject: C,
197
+ isDragActive: k
199
198
  }) => {
200
- const B = H(
199
+ const $ = E(
201
200
  "pco-org-avatar__dropzone",
202
- `pco-org-avatar__dropzone--${C}`,
201
+ `pco-org-avatar__dropzone--${U}`,
203
202
  {
204
203
  "pco-org-avatar__dropzone--image": i || s,
205
204
  "pco-org-avatar__dropzone--focused": p,
206
205
  "pco-org-avatar__dropzone--accepted": A,
207
- "pco-org-avatar__dropzone--rejected": N && k
206
+ "pco-org-avatar__dropzone--rejected": k && C
208
207
  }
209
208
  );
210
- return /* @__PURE__ */ o("div", { ...u({ className: B }), children: [
209
+ return /* @__PURE__ */ o("div", { ...u({ className: $ }), children: [
211
210
  /* @__PURE__ */ e("input", { ...n() }),
212
211
  i ? /* @__PURE__ */ e(
213
212
  "img",
@@ -229,10 +228,10 @@ function D({
229
228
  height: "64",
230
229
  viewBox: "0 0 16 16",
231
230
  "aria-hidden": "true",
232
- children: /* @__PURE__ */ e("path", { d: X })
231
+ children: /* @__PURE__ */ e("path", { d: J })
233
232
  }
234
233
  ),
235
- N && k ? /* @__PURE__ */ o(b, { children: [
234
+ k && C ? /* @__PURE__ */ o(b, { children: [
236
235
  /* @__PURE__ */ e("h2", { children: "Wrong file type" }),
237
236
  /* @__PURE__ */ e("p", { children: "Please upload a PNG or JPG file." })
238
237
  ] }) : /* @__PURE__ */ o(b, { children: [
@@ -247,34 +246,34 @@ function D({
247
246
  ] }),
248
247
  /* @__PURE__ */ o("div", { className: "dialog__actions", children: [
249
248
  s && /* @__PURE__ */ e(
250
- j,
249
+ z,
251
250
  {
252
251
  label: "Delete logo",
253
252
  kind: "delete",
254
- onClick: O,
255
- loading: d,
256
- disabled: d,
253
+ onClick: L,
254
+ loading: c,
255
+ disabled: c,
257
256
  className: "mr-a"
258
257
  }
259
258
  ),
260
259
  /* @__PURE__ */ e(
261
- j,
260
+ z,
262
261
  {
263
262
  type: "button",
264
263
  label: "Cancel",
265
- commandfor: U,
264
+ commandfor: w,
266
265
  command: "close",
267
- disabled: d
266
+ disabled: c
268
267
  }
269
268
  ),
270
269
  /* @__PURE__ */ e(
271
- j,
270
+ z,
272
271
  {
273
272
  type: "submit",
274
273
  label: "Update logo",
275
274
  kind: "primary",
276
- loading: d,
277
- disabled: !i || d
275
+ loading: c,
276
+ disabled: !i || c
278
277
  }
279
278
  )
280
279
  ] })
@@ -285,47 +284,44 @@ function D({
285
284
  )
286
285
  ] });
287
286
  }
288
- function oe({
287
+ function te({
289
288
  avatarUrl: a,
290
289
  darkModeAvatarUrl: l,
291
290
  orgName: r,
292
- pcoApp: t,
293
- pcoEnv: c,
294
- csrfToken: y,
295
- showDarkModeAvatar: w = !1
291
+ pcoEnv: t,
292
+ csrfToken: d,
293
+ showDarkModeAvatar: y = !1
296
294
  }) {
297
295
  const [i, g] = m(a), [s, f] = m(
298
296
  l
299
- ), d = (_, h) => {
297
+ ), c = (_, h) => {
300
298
  _ === "avatar" ? g(h) : _ === "dark_mode_avatar" && f(h);
301
299
  };
302
300
  return /* @__PURE__ */ o("div", { className: "d-f g-1", children: [
303
301
  /* @__PURE__ */ e(
304
- D,
302
+ M,
305
303
  {
306
304
  avatarUrl: i,
307
305
  organization: r,
308
306
  mode: "avatar",
309
- pcoApp: t,
310
- pcoEnv: c,
311
- csrfToken: y,
312
- onAvatarUpdate: d
307
+ pcoEnv: t,
308
+ csrfToken: d,
309
+ onAvatarUpdate: c
313
310
  }
314
311
  ),
315
- w && /* @__PURE__ */ e(
316
- D,
312
+ y && /* @__PURE__ */ e(
313
+ M,
317
314
  {
318
315
  avatarUrl: s || i,
319
316
  organization: r,
320
317
  mode: "dark_mode_avatar",
321
- pcoApp: t,
322
- pcoEnv: c,
323
- csrfToken: y,
324
- onAvatarUpdate: d
318
+ pcoEnv: t,
319
+ csrfToken: d,
320
+ onAvatarUpdate: c
325
321
  }
326
322
  )
327
323
  ] });
328
324
  }
329
325
  export {
330
- oe as OrganizationAvatars
326
+ te as OrganizationAvatars
331
327
  };
@@ -1,2 +1,2 @@
1
1
  import type { OrganizationAvatarProps } from "./types";
2
- export declare function OrganizationAvatar({ avatarUrl, organization, mode, pcoApp, pcoEnv, csrfToken, onAvatarUpdate, }: OrganizationAvatarProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function OrganizationAvatar({ avatarUrl, organization, mode, pcoEnv, csrfToken, onAvatarUpdate, }: OrganizationAvatarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { OrganizationAvatarsProps } from "./types";
2
- export declare function OrganizationAvatars({ avatarUrl: initialAvatarUrl, darkModeAvatarUrl: initialDarkModeAvatarUrl, orgName, pcoApp, pcoEnv, csrfToken, showDarkModeAvatar, }: OrganizationAvatarsProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function OrganizationAvatars({ avatarUrl: initialAvatarUrl, darkModeAvatarUrl: initialDarkModeAvatarUrl, orgName, pcoEnv, csrfToken, showDarkModeAvatar, }: OrganizationAvatarsProps): import("react/jsx-runtime").JSX.Element;
package/dist/types.d.ts CHANGED
@@ -11,7 +11,6 @@ export type OrganizationAvatarProps = {
11
11
  avatarUrl?: string;
12
12
  organization: string;
13
13
  mode: "avatar" | "dark_mode_avatar";
14
- pcoApp: string;
15
14
  pcoEnv?: string;
16
15
  csrfToken: string;
17
16
  onAvatarUpdate: (attrName: string, newUrl: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/organization-avatars",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Organization avatar upload components for Planning Center apps",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.22",