@bynder/compact-view 5.2.2 → 5.2.3

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/index9.js CHANGED
@@ -1,55 +1,20 @@
1
- import { err as p, ok as u } from "./result.type.js";
2
- import { ensureValidUrl as q } from "./url.js";
3
- import { normalizeAssetsResponse as C } from "./normalizeResponse.js";
4
- import { processAssetsWithLimitedUseFlag as k } from "./getLimitedUseThumbnails.js";
5
- const o = /* @__PURE__ */ new Map();
6
- async function G(g) {
7
- const { query: d, variables: h, auth: a, noCache: l, isNewGQL: y } = g;
8
- if (!a) return p("No authentication provided");
9
- const n = a.getAccessToken?.(), $ = "5.2.2";
10
- let e = a.accountDomain !== void 0 ? q(a.accountDomain.trim()) : `https://${window.location.host}`;
11
- e.charAt(e.length - 1) === "/" && (e = e.slice(0, -1));
12
- const i = `${e}:${d}:${JSON.stringify(h)}:${n}`;
13
- if (o.has(i) && !l)
14
- return u(o.get(i));
15
- const m = {
1
+ import "./index12.js";
2
+ import r from "./axios.js";
3
+ const n = (e) => e.data, s = r.create({
4
+ timeout: 1e4,
5
+ headers: {
16
6
  Accept: "application/json",
17
- "Content-Type": "application/json",
18
- // Custom header for UCV analytics tracking
19
- "X-Bynder-Integration": `UCV/v${$}`
20
- }, v = {
21
- method: "post",
22
- headers: n === void 0 ? m : { ...m, Authorization: `Bearer ${n}` },
23
- body: JSON.stringify({ query: d, variables: h })
24
- };
25
- let s, c;
26
- const w = y ? "/v7/api/graphql" : "/graphql";
7
+ "Content-Type": "application/json"
8
+ }
9
+ }), i = async (e, o) => {
27
10
  try {
28
- if (s = await (await fetch(`${e}${w}`, v)).json(), s.errors !== void 0)
29
- return p(s.errors.map((r) => r.message).join(","));
30
- const A = ["similaritySearch", "searchAssets"];
31
- await Promise.all(
32
- A.map(async (r) => {
33
- const t = s.data[r];
34
- if (t?.assets?.nodes) {
35
- const N = t.assets.nodes, j = await k(N, n);
36
- s.data[r] = {
37
- ...t,
38
- assets: {
39
- ...t.assets,
40
- nodes: j,
41
- pageInfo: t.assets.pageInfo,
42
- totalCount: t.assets.totalCount
43
- }
44
- };
45
- }
46
- })
47
- ), c = C(s.data);
48
- } catch (f) {
49
- return p(f);
11
+ const t = await s.get(e, o);
12
+ return n(t);
13
+ } catch (t) {
14
+ throw console.error("GET request error:", t), t;
50
15
  }
51
- return l || (o.set(i, c), o.size > 50 && o.delete(o.keys().next().value)), u(c);
52
- }
16
+ };
53
17
  export {
54
- G as fetchWithGraphql
18
+ i as getRequest,
19
+ n as onSuccess
55
20
  };
@@ -1,4 +1,4 @@
1
- import o from "./index18.js";
1
+ import o from "./index19.js";
2
2
  const n = o.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, e) => (t) => (t = new URL(t, o.origin), r.protocol === t.protocol && r.host === t.host && (e || r.port === t.port)))(
3
3
  new URL(o.origin),
4
4
  o.navigator && /(msie|trident)/i.test(o.navigator.userAgent)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bynder/compact-view",
3
3
  "description": "Bynder Compact View",
4
- "version": "5.2.2",
4
+ "version": "5.2.3",
5
5
  "author": "Bynder",
6
6
  "license": "UNLICENSED",
7
7
  "main": "index.js",
package/resolveConfig.js CHANGED
@@ -1,4 +1,4 @@
1
- import n from "./index18.js";
1
+ import n from "./index19.js";
2
2
  import l from "./utils6.js";
3
3
  import h from "./isURLSameOrigin.js";
4
4
  import c from "./cookies.js";
@@ -1,6 +1,6 @@
1
1
  import e from "./utils6.js";
2
2
  import n from "./toFormData.js";
3
- import r from "./index18.js";
3
+ import r from "./index19.js";
4
4
  function c(o, i) {
5
5
  return n(o, new r.classes.URLSearchParams(), Object.assign({
6
6
  visitor: function(t, s, f, a) {
package/useFonts.js CHANGED
@@ -4,7 +4,7 @@ import { useDebouncedCallback as x } from "./index.module3.js";
4
4
  import { notify as P } from "./notify.js";
5
5
  import { useTranslate as B } from "./index6.js";
6
6
  import { API as T } from "./api2.js";
7
- import { filterFamilies as k, moveSelectedFamilyToTop as w, getFamilyAndSubfamily as U, getDefaultFont as H } from "./utils8.js";
7
+ import { filterFamilies as k, moveSelectedFamilyToTop as w, getFamilyAndSubfamily as U, getDefaultFont as H } from "./utils7.js";
8
8
  import { captureException as b } from "./exports3.js";
9
9
  const M = 500, Z = 20;
10
10
  function $(A) {
package/utils7.js CHANGED
@@ -1,9 +1,70 @@
1
- const e = typeof window < "u" && typeof document < "u", o = typeof navigator == "object" && navigator || void 0, n = e && (!o || ["ReactNative", "NativeScript", "NS"].indexOf(o.product) < 0), t = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
2
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", r = e && window.location.href || "http://localhost";
1
+ import { produce as e } from "./immer.js";
2
+ import { API as a } from "./api2.js";
3
+ function F(i, t) {
4
+ return e(i, (n) => {
5
+ const o = n.findIndex((f) => f.id === t?.id);
6
+ o !== -1 && n.splice(o, 1), n.unshift(t);
7
+ });
8
+ }
9
+ function c(i, t = !1) {
10
+ return t ? i.map((n) => ({
11
+ ...n,
12
+ subfamilies: n.subfamilies.filter((o) => !o.is_italic)
13
+ })) : i;
14
+ }
15
+ function r(i, t) {
16
+ return i.subfamilies.find(
17
+ (o) => o.weight === t
18
+ ) || i.subfamilies[0];
19
+ }
20
+ async function u(i, t = "400") {
21
+ const n = await s(), o = i || n.family.id;
22
+ if (!o)
23
+ throw new Error(`Fonts: Family not found for (default) id: ${o}`);
24
+ const f = await a.getFontFamilyById(o);
25
+ if (!f)
26
+ throw new Error(`Fonts: Family not found for id: ${o}`);
27
+ const l = r(f, t);
28
+ if (!l)
29
+ throw new Error(`Fonts: Subfamily not found for weight: ${t}`);
30
+ return {
31
+ family: f,
32
+ subfamily: l
33
+ };
34
+ }
35
+ async function m(i) {
36
+ const t = await a.getSubfamilyById(i);
37
+ if (!t)
38
+ throw new Error(`Fonts: Subfamily not found for id: ${i}`);
39
+ const n = await a.getFontFamilyById(t.font_id);
40
+ if (!n)
41
+ throw new Error(`Fonts: Family not found for id: ${t.font_id}`);
42
+ return {
43
+ family: n,
44
+ subfamily: t
45
+ };
46
+ }
47
+ async function s() {
48
+ const i = await a.getDefaultGlobalFont();
49
+ if (!i)
50
+ throw new Error("FontManager v2: (Default) Global Font Family not found");
51
+ const t = i.family.subfamilies.find(
52
+ (n) => n.id === i.default_subfamily_id
53
+ );
54
+ if (!t)
55
+ throw new Error("FontManager v2: (Default) Global Font Subfamily not found");
56
+ return {
57
+ family: i.family,
58
+ subfamily: t
59
+ };
60
+ }
61
+ async function w(i, t) {
62
+ let n;
63
+ return t ? n = await m(t) : n = await u(i), n;
64
+ }
3
65
  export {
4
- e as hasBrowserEnv,
5
- n as hasStandardBrowserEnv,
6
- t as hasStandardBrowserWebWorkerEnv,
7
- o as navigator,
8
- r as origin
66
+ c as filterFamilies,
67
+ s as getDefaultFont,
68
+ w as getFamilyAndSubfamily,
69
+ F as moveSelectedFamilyToTop
9
70
  };
package/utils8.js CHANGED
@@ -1,70 +1,9 @@
1
- import { produce as e } from "./immer.js";
2
- import { API as a } from "./api2.js";
3
- function F(i, t) {
4
- return e(i, (n) => {
5
- const o = n.findIndex((f) => f.id === t?.id);
6
- o !== -1 && n.splice(o, 1), n.unshift(t);
7
- });
8
- }
9
- function c(i, t = !1) {
10
- return t ? i.map((n) => ({
11
- ...n,
12
- subfamilies: n.subfamilies.filter((o) => !o.is_italic)
13
- })) : i;
14
- }
15
- function r(i, t) {
16
- return i.subfamilies.find(
17
- (o) => o.weight === t
18
- ) || i.subfamilies[0];
19
- }
20
- async function u(i, t = "400") {
21
- const n = await s(), o = i || n.family.id;
22
- if (!o)
23
- throw new Error(`Fonts: Family not found for (default) id: ${o}`);
24
- const f = await a.getFontFamilyById(o);
25
- if (!f)
26
- throw new Error(`Fonts: Family not found for id: ${o}`);
27
- const l = r(f, t);
28
- if (!l)
29
- throw new Error(`Fonts: Subfamily not found for weight: ${t}`);
30
- return {
31
- family: f,
32
- subfamily: l
33
- };
34
- }
35
- async function m(i) {
36
- const t = await a.getSubfamilyById(i);
37
- if (!t)
38
- throw new Error(`Fonts: Subfamily not found for id: ${i}`);
39
- const n = await a.getFontFamilyById(t.font_id);
40
- if (!n)
41
- throw new Error(`Fonts: Family not found for id: ${t.font_id}`);
42
- return {
43
- family: n,
44
- subfamily: t
45
- };
46
- }
47
- async function s() {
48
- const i = await a.getDefaultGlobalFont();
49
- if (!i)
50
- throw new Error("FontManager v2: (Default) Global Font Family not found");
51
- const t = i.family.subfamilies.find(
52
- (n) => n.id === i.default_subfamily_id
53
- );
54
- if (!t)
55
- throw new Error("FontManager v2: (Default) Global Font Subfamily not found");
56
- return {
57
- family: i.family,
58
- subfamily: t
59
- };
60
- }
61
- async function w(i, t) {
62
- let n;
63
- return t ? n = await m(t) : n = await u(i), n;
64
- }
1
+ const e = typeof window < "u" && typeof document < "u", o = typeof navigator == "object" && navigator || void 0, n = e && (!o || ["ReactNative", "NativeScript", "NS"].indexOf(o.product) < 0), t = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
2
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", r = e && window.location.href || "http://localhost";
65
3
  export {
66
- c as filterFamilies,
67
- s as getDefaultFont,
68
- w as getFamilyAndSubfamily,
69
- F as moveSelectedFamilyToTop
4
+ e as hasBrowserEnv,
5
+ n as hasStandardBrowserEnv,
6
+ t as hasStandardBrowserWebWorkerEnv,
7
+ o as navigator,
8
+ r as origin
70
9
  };
package/xhr.js CHANGED
@@ -4,7 +4,7 @@ import L from "./transitional.js";
4
4
  import r from "./AxiosError.js";
5
5
  import v from "./CanceledError.js";
6
6
  import y from "./parseProtocol.js";
7
- import O from "./index18.js";
7
+ import O from "./index19.js";
8
8
  import H from "./AxiosHeaders.js";
9
9
  import { progressEventReducer as q } from "./progressEventReducer.js";
10
10
  import U from "./resolveConfig.js";
package/Middleware2.js DELETED
@@ -1,49 +0,0 @@
1
- import { RULESET as g, KEYFRAMES as x, DECLARATION as $, WEBKIT as w, MOZ as n, MS as y } from "./Enum.js";
2
- import { combine as A, replace as u, sizeof as M, match as R, assign as h, filter as E } from "./Utility.js";
3
- import { copy as i, lift as t } from "./Tokenizer.js";
4
- import { serialize as S } from "./Serializer.js";
5
- import { prefix as T } from "./Prefixer.js";
6
- function B(r) {
7
- var o = M(r);
8
- return function(f, s, p, d) {
9
- for (var c = "", a = 0; a < o; a++)
10
- c += r[a](f, s, p, d) || "";
11
- return c;
12
- };
13
- }
14
- function C(r) {
15
- return function(o) {
16
- o.root || (o = o.return) && r(o);
17
- };
18
- }
19
- function D(r, o, f, s) {
20
- if (r.length > -1 && !r.return)
21
- switch (r.type) {
22
- case $:
23
- r.return = T(r.value, r.length, f);
24
- return;
25
- case x:
26
- return S([i(r, { value: u(r.value, "@", "@" + w) })], s);
27
- case g:
28
- if (r.length)
29
- return A(f = r.props, function(p) {
30
- switch (R(p, s = /(::plac\w+|:read-\w+)/)) {
31
- // :read-(only|write)
32
- case ":read-only":
33
- case ":read-write":
34
- t(i(r, { props: [u(p, /:(read-\w+)/, ":" + n + "$1")] })), t(i(r, { props: [p] })), h(r, { props: E(f, s) });
35
- break;
36
- // :placeholder
37
- case "::placeholder":
38
- t(i(r, { props: [u(p, /:(plac\w+)/, ":" + w + "input-$1")] })), t(i(r, { props: [u(p, /:(plac\w+)/, ":" + n + "$1")] })), t(i(r, { props: [u(p, /:(plac\w+)/, y + "input-$1")] })), t(i(r, { props: [p] })), h(r, { props: E(f, s) });
39
- break;
40
- }
41
- return "";
42
- });
43
- }
44
- }
45
- export {
46
- B as middleware,
47
- D as prefixer,
48
- C as rulesheet
49
- };
package/middleware.js DELETED
@@ -1,177 +0,0 @@
1
- const g = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, S = /* @__PURE__ */ new Map(), h = (i) => {
2
- const c = S.get(i);
3
- return c ? Object.fromEntries(
4
- Object.entries(c.stores).map(([o, d]) => [o, d.getState()])
5
- ) : {};
6
- }, E = (i, c, o) => {
7
- if (i === void 0)
8
- return {
9
- type: "untracked",
10
- connection: c.connect(o)
11
- };
12
- const d = S.get(o.name);
13
- if (d)
14
- return { type: "tracked", store: i, ...d };
15
- const e = {
16
- connection: c.connect(o),
17
- stores: {}
18
- };
19
- return S.set(o.name, e), { type: "tracked", store: i, ...e };
20
- }, C = (i, c) => {
21
- if (c === void 0) return;
22
- const o = S.get(i);
23
- o && (delete o.stores[c], Object.keys(o.stores).length === 0 && S.delete(i));
24
- }, w = (i) => {
25
- var c, o;
26
- if (!i) return;
27
- const d = i.split(`
28
- `), e = d.findIndex(
29
- (m) => m.includes("api.setState")
30
- );
31
- if (e < 0) return;
32
- const y = ((c = d[e + 1]) == null ? void 0 : c.trim()) || "";
33
- return (o = /.+ (.+) .+/.exec(y)) == null ? void 0 : o[1];
34
- }, I = (i, c = {}) => (o, d, e) => {
35
- const { enabled: y, anonymousActionType: m, store: s, ...f } = c;
36
- let O;
37
- try {
38
- O = (y ?? (g ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
39
- } catch {
40
- }
41
- if (!O)
42
- return i(o, d, e);
43
- const { connection: t, ...p } = E(s, O, f);
44
- let v = !0;
45
- e.setState = (r, l, n) => {
46
- const a = o(r, l);
47
- if (!v) return a;
48
- const b = n === void 0 ? {
49
- type: m || w(new Error().stack) || "anonymous"
50
- } : typeof n == "string" ? { type: n } : n;
51
- return s === void 0 ? (t?.send(b, d()), a) : (t?.send(
52
- {
53
- ...b,
54
- type: `${s}/${b.type}`
55
- },
56
- {
57
- ...h(f.name),
58
- [s]: e.getState()
59
- }
60
- ), a);
61
- }, e.devtools = {
62
- cleanup: () => {
63
- t && typeof t.unsubscribe == "function" && t.unsubscribe(), C(f.name, s);
64
- }
65
- };
66
- const u = (...r) => {
67
- const l = v;
68
- v = !1, o(...r), v = l;
69
- }, _ = i(e.setState, d, e);
70
- if (p.type === "untracked" ? t?.init(_) : (p.stores[p.store] = e, t?.init(
71
- Object.fromEntries(
72
- Object.entries(p.stores).map(([r, l]) => [
73
- r,
74
- r === p.store ? _ : l.getState()
75
- ])
76
- )
77
- )), e.dispatchFromDevtools && typeof e.dispatch == "function") {
78
- let r = !1;
79
- const l = e.dispatch;
80
- e.dispatch = (...n) => {
81
- (g ? "production" : void 0) !== "production" && n[0].type === "__setState" && !r && (console.warn(
82
- '[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
83
- ), r = !0), l(...n);
84
- };
85
- }
86
- return t.subscribe((r) => {
87
- var l;
88
- switch (r.type) {
89
- case "ACTION":
90
- if (typeof r.payload != "string") {
91
- console.error(
92
- "[zustand devtools middleware] Unsupported action format"
93
- );
94
- return;
95
- }
96
- return T(
97
- r.payload,
98
- (n) => {
99
- if (n.type === "__setState") {
100
- if (s === void 0) {
101
- u(n.state);
102
- return;
103
- }
104
- Object.keys(n.state).length !== 1 && console.error(
105
- `
106
- [zustand devtools middleware] Unsupported __setState action format.
107
- When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
108
- and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
109
- `
110
- );
111
- const a = n.state[s];
112
- if (a == null)
113
- return;
114
- JSON.stringify(e.getState()) !== JSON.stringify(a) && u(a);
115
- return;
116
- }
117
- e.dispatchFromDevtools && typeof e.dispatch == "function" && e.dispatch(n);
118
- }
119
- );
120
- case "DISPATCH":
121
- switch (r.payload.type) {
122
- case "RESET":
123
- return u(_), s === void 0 ? t?.init(e.getState()) : t?.init(h(f.name));
124
- case "COMMIT":
125
- if (s === void 0) {
126
- t?.init(e.getState());
127
- return;
128
- }
129
- return t?.init(h(f.name));
130
- case "ROLLBACK":
131
- return T(r.state, (n) => {
132
- if (s === void 0) {
133
- u(n), t?.init(e.getState());
134
- return;
135
- }
136
- u(n[s]), t?.init(h(f.name));
137
- });
138
- case "JUMP_TO_STATE":
139
- case "JUMP_TO_ACTION":
140
- return T(r.state, (n) => {
141
- if (s === void 0) {
142
- u(n);
143
- return;
144
- }
145
- JSON.stringify(e.getState()) !== JSON.stringify(n[s]) && u(n[s]);
146
- });
147
- case "IMPORT_STATE": {
148
- const { nextLiftedState: n } = r.payload, a = (l = n.computedStates.slice(-1)[0]) == null ? void 0 : l.state;
149
- if (!a) return;
150
- u(s === void 0 ? a : a[s]), t?.send(
151
- null,
152
- // FIXME no-any
153
- n
154
- );
155
- return;
156
- }
157
- case "PAUSE_RECORDING":
158
- return v = !v;
159
- }
160
- return;
161
- }
162
- }), _;
163
- }, D = I, T = (i, c) => {
164
- let o;
165
- try {
166
- o = JSON.parse(i);
167
- } catch (d) {
168
- console.error(
169
- "[zustand devtools middleware] Could not parse the received json",
170
- d
171
- );
172
- }
173
- o !== void 0 && c(o);
174
- };
175
- export {
176
- D as devtools
177
- };