@solostylist/ui-kit 1.0.45 → 1.0.46

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.
@@ -1,325 +1,47 @@
1
- import { j as w } from "../jsx-runtime-C5mzlN2N.js";
2
- import l from "react";
3
- import { P as u } from "../createTheme-CyFSna1a.js";
4
- import ne from "../s-text-field/s-text-field.js";
5
- import oe from "./stripe-input.js";
6
- function M(r, e) {
7
- var t = Object.keys(r);
8
- if (Object.getOwnPropertySymbols) {
9
- var n = Object.getOwnPropertySymbols(r);
10
- e && (n = n.filter(function(a) {
11
- return Object.getOwnPropertyDescriptor(r, a).enumerable;
12
- })), t.push.apply(t, n);
13
- }
14
- return t;
15
- }
16
- function W(r) {
17
- for (var e = 1; e < arguments.length; e++) {
18
- var t = arguments[e] != null ? arguments[e] : {};
19
- e % 2 ? M(Object(t), !0).forEach(function(n) {
20
- K(r, n, t[n]);
21
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : M(Object(t)).forEach(function(n) {
22
- Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(t, n));
23
- });
24
- }
25
- return r;
26
- }
27
- function j(r) {
28
- "@babel/helpers - typeof";
29
- return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? j = function(e) {
30
- return typeof e;
31
- } : j = function(e) {
32
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
33
- }, j(r);
34
- }
35
- function K(r, e, t) {
36
- return e in r ? Object.defineProperty(r, e, {
37
- value: t,
38
- enumerable: !0,
39
- configurable: !0,
40
- writable: !0
41
- }) : r[e] = t, r;
42
- }
43
- function ae(r, e) {
44
- if (r == null) return {};
45
- var t = {}, n = Object.keys(r), a, o;
46
- for (o = 0; o < n.length; o++)
47
- a = n[o], !(e.indexOf(a) >= 0) && (t[a] = r[a]);
48
- return t;
49
- }
50
- function ie(r, e) {
51
- if (r == null) return {};
52
- var t = ae(r, e), n, a;
53
- if (Object.getOwnPropertySymbols) {
54
- var o = Object.getOwnPropertySymbols(r);
55
- for (a = 0; a < o.length; a++)
56
- n = o[a], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(r, n) && (t[n] = r[n]);
57
- }
58
- return t;
59
- }
60
- function ue(r, e) {
61
- return ce(r) || se(r, e) || le(r, e) || pe();
62
- }
63
- function ce(r) {
64
- if (Array.isArray(r)) return r;
65
- }
66
- function se(r, e) {
67
- var t = r && (typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"]);
68
- if (t != null) {
69
- var n = [], a = !0, o = !1, p, h;
70
- try {
71
- for (t = t.call(r); !(a = (p = t.next()).done) && (n.push(p.value), !(e && n.length === e)); a = !0)
72
- ;
73
- } catch (i) {
74
- o = !0, h = i;
75
- } finally {
76
- try {
77
- !a && t.return != null && t.return();
78
- } finally {
79
- if (o) throw h;
80
- }
81
- }
82
- return n;
83
- }
84
- }
85
- function le(r, e) {
86
- if (r) {
87
- if (typeof r == "string") return D(r, e);
88
- var t = Object.prototype.toString.call(r).slice(8, -1);
89
- if (t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set") return Array.from(r);
90
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return D(r, e);
91
- }
92
- }
93
- function D(r, e) {
94
- (e == null || e > r.length) && (e = r.length);
95
- for (var t = 0, n = new Array(e); t < e; t++) n[t] = r[t];
96
- return n;
97
- }
98
- function pe() {
99
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
100
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
101
- }
102
- var y = function(e, t, n) {
103
- var a = !!n, o = l.useRef(n);
104
- l.useEffect(function() {
105
- o.current = n;
106
- }, [n]), l.useEffect(function() {
107
- if (!a || !e)
108
- return function() {
109
- };
110
- var p = function() {
111
- o.current && o.current.apply(o, arguments);
112
- };
113
- return e.on(t, p), function() {
114
- e.off(t, p);
115
- };
116
- }, [a, t, e, o]);
117
- }, fe = function(e) {
118
- var t = l.useRef(e);
119
- return l.useEffect(function() {
120
- t.current = e;
121
- }, [e]), t.current;
122
- }, A = function(e) {
123
- return e !== null && j(e) === "object";
124
- }, F = "[object Object]", de = function r(e, t) {
125
- if (!A(e) || !A(t))
126
- return e === t;
127
- var n = Array.isArray(e), a = Array.isArray(t);
128
- if (n !== a) return !1;
129
- var o = Object.prototype.toString.call(e) === F, p = Object.prototype.toString.call(t) === F;
130
- if (o !== p) return !1;
131
- if (!o && !n) return e === t;
132
- var h = Object.keys(e), i = Object.keys(t);
133
- if (h.length !== i.length) return !1;
134
- for (var b = {}, g = 0; g < h.length; g += 1)
135
- b[h[g]] = !0;
136
- for (var E = 0; E < i.length; E += 1)
137
- b[i[E]] = !0;
138
- var m = Object.keys(b);
139
- if (m.length !== h.length)
140
- return !1;
141
- var P = e, R = t, k = function(S) {
142
- return r(P[S], R[S]);
143
- };
144
- return m.every(k);
145
- }, me = function(e, t, n) {
146
- return A(e) ? Object.keys(e).reduce(function(a, o) {
147
- var p = !A(t) || !de(e[o], t[o]);
148
- return n.includes(o) ? (p && console.warn("Unsupported prop change: options.".concat(o, " is not a mutable property.")), a) : p ? W(W({}, a || {}), {}, K({}, o, e[o])) : a;
149
- }, null) : null;
150
- }, $ = /* @__PURE__ */ l.createContext(null);
151
- $.displayName = "ElementsContext";
152
- var ye = function(e, t) {
153
- if (!e)
154
- throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t, " in an <Elements> provider."));
155
- return e;
156
- };
157
- u.any, u.object;
158
- u.func.isRequired;
159
- var z = /* @__PURE__ */ l.createContext(null);
160
- z.displayName = "CheckoutSdkContext";
161
- var he = function(e, t) {
162
- if (!e)
163
- throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat(t, " in an <CheckoutProvider> provider."));
164
- return e;
165
- }, ve = /* @__PURE__ */ l.createContext(null);
166
- ve.displayName = "CheckoutContext";
167
- u.any, u.shape({
168
- fetchClientSecret: u.func.isRequired,
169
- elementsOptions: u.object
170
- }).isRequired;
171
- var Y = function(e) {
172
- var t = l.useContext(z), n = l.useContext($);
173
- if (t && n)
174
- throw new Error("You cannot wrap the part of your app that ".concat(e, " in both <CheckoutProvider> and <Elements> providers."));
175
- return t ? he(t, e) : ye(n, e);
176
- }, Ce = ["mode"], be = function(e) {
177
- return e.charAt(0).toUpperCase() + e.slice(1);
178
- }, c = function(e, t) {
179
- var n = "".concat(be(e), "Element"), a = function(i) {
180
- var b = i.id, g = i.className, E = i.options, m = E === void 0 ? {} : E, P = i.onBlur, R = i.onFocus, k = i.onReady, B = i.onChange, S = i.onEscape, V = i.onClick, H = i.onLoadError, J = i.onLoaderStart, G = i.onNetworksChange, Q = i.onConfirm, X = i.onCancel, Z = i.onShippingAddressChange, ee = i.onShippingRateChange, x = Y("mounts <".concat(n, ">")), O = "elements" in x ? x.elements : null, C = "checkoutSdk" in x ? x.checkoutSdk : null, te = l.useState(null), I = ue(te, 2), d = I[0], re = I[1], v = l.useRef(null), N = l.useRef(null);
181
- y(d, "blur", P), y(d, "focus", R), y(d, "escape", S), y(d, "click", V), y(d, "loaderror", H), y(d, "loaderstart", J), y(d, "networkschange", G), y(d, "confirm", Q), y(d, "cancel", X), y(d, "shippingaddresschange", Z), y(d, "shippingratechange", ee), y(d, "change", B);
182
- var T;
183
- k && (e === "expressCheckout" ? T = k : T = function() {
184
- k(d);
185
- }), y(d, "ready", T), l.useLayoutEffect(function() {
186
- if (v.current === null && N.current !== null && (O || C)) {
187
- var f = null;
188
- if (C)
189
- switch (e) {
190
- case "payment":
191
- f = C.createPaymentElement(m);
192
- break;
193
- case "address":
194
- if ("mode" in m) {
195
- var _ = m.mode, q = ie(m, Ce);
196
- if (_ === "shipping")
197
- f = C.createShippingAddressElement(q);
198
- else if (_ === "billing")
199
- f = C.createBillingAddressElement(q);
200
- else
201
- throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.");
202
- } else
203
- throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");
204
- break;
205
- case "expressCheckout":
206
- f = C.createExpressCheckoutElement(m);
207
- break;
208
- case "currencySelector":
209
- f = C.createCurrencySelectorElement();
210
- break;
211
- default:
212
- throw new Error("Invalid Element type ".concat(n, ". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."));
213
- }
214
- else O && (f = O.create(e, m));
215
- v.current = f, re(f), f && f.mount(N.current);
216
- }
217
- }, [O, C, m]);
218
- var U = fe(m);
219
- return l.useEffect(function() {
220
- if (v.current) {
221
- var f = me(m, U, ["paymentRequest"]);
222
- f && "update" in v.current && v.current.update(f);
223
- }
224
- }, [m, U]), l.useLayoutEffect(function() {
225
- return function() {
226
- if (v.current && typeof v.current.destroy == "function")
227
- try {
228
- v.current.destroy(), v.current = null;
229
- } catch {
230
- }
231
- };
232
- }, []), /* @__PURE__ */ l.createElement("div", {
233
- id: b,
234
- className: g,
235
- ref: N
236
- });
237
- }, o = function(i) {
238
- Y("mounts <".concat(n, ">"));
239
- var b = i.id, g = i.className;
240
- return /* @__PURE__ */ l.createElement("div", {
241
- id: b,
242
- className: g
243
- });
244
- }, p = t ? o : a;
245
- return p.propTypes = {
246
- id: u.string,
247
- className: u.string,
248
- onChange: u.func,
249
- onBlur: u.func,
250
- onFocus: u.func,
251
- onReady: u.func,
252
- onEscape: u.func,
253
- onClick: u.func,
254
- onLoadError: u.func,
255
- onLoaderStart: u.func,
256
- onNetworksChange: u.func,
257
- onConfirm: u.func,
258
- onCancel: u.func,
259
- onShippingAddressChange: u.func,
260
- onShippingRateChange: u.func,
261
- options: u.object
262
- }, p.displayName = n, p.__elementType = e, p;
263
- }, s = typeof window > "u", ge = /* @__PURE__ */ l.createContext(null);
264
- ge.displayName = "EmbeddedCheckoutProviderContext";
265
- c("auBankAccount", s);
266
- c("card", s);
267
- var Ee = c("cardNumber", s), ke = c("cardExpiry", s), Se = c("cardCvc", s);
268
- c("fpxBank", s);
269
- c("iban", s);
270
- c("idealBank", s);
271
- c("p24Bank", s);
272
- c("epsBank", s);
273
- c("payment", s);
274
- c("expressCheckout", s);
275
- c("currencySelector", s);
276
- c("paymentRequestButton", s);
277
- c("linkAuthentication", s);
278
- c("address", s);
279
- c("shippingAddress", s);
280
- c("paymentMethodMessaging", s);
281
- c("affirmMessage", s);
282
- c("afterpayClearpayMessage", s);
283
- const L = (r) => {
284
- var i;
285
- const { helperText: e, slotProps: t, inputProps: n, error: a, labelErrorMessage: o, stripeElement: p, ...h } = r;
286
- return /* @__PURE__ */ w.jsx(
287
- ne,
1
+ import { j as r } from "../jsx-runtime-C5mzlN2N.js";
2
+ import { CardNumberElement as a, CardExpiryElement as E, CardCvcElement as s } from "@stripe/react-stripe-js";
3
+ import C from "../s-text-field/s-text-field.js";
4
+ import b from "./stripe-input.js";
5
+ const n = (t) => {
6
+ var p;
7
+ const { helperText: u, slotProps: e, inputProps: m, error: i, labelErrorMessage: l, stripeElement: o, ...x } = t;
8
+ return /* @__PURE__ */ r.jsx(
9
+ C,
288
10
  {
289
11
  fullWidth: !0,
290
12
  slotProps: {
291
13
  inputLabel: {
292
- ...t == null ? void 0 : t.inputLabel,
14
+ ...e == null ? void 0 : e.inputLabel,
293
15
  shrink: !0
294
16
  },
295
17
  input: {
296
- ...t == null ? void 0 : t.input,
18
+ ...e == null ? void 0 : e.input,
297
19
  inputProps: {
298
- ...n,
299
- ...(i = t == null ? void 0 : t.input) == null ? void 0 : i.inputProps,
300
- component: p
20
+ ...m,
21
+ ...(p = e == null ? void 0 : e.input) == null ? void 0 : p.inputProps,
22
+ component: o
301
23
  },
302
- inputComponent: oe
24
+ inputComponent: b
303
25
  }
304
26
  },
305
- error: a,
306
- helperText: a ? o : e,
307
- ...h
27
+ error: i,
28
+ helperText: i ? l : u,
29
+ ...x
308
30
  }
309
31
  );
310
32
  };
311
- function Pe(r) {
312
- return /* @__PURE__ */ w.jsx(L, { label: "Card Number", stripeElement: Ee, ...r });
33
+ function j(t) {
34
+ return /* @__PURE__ */ r.jsx(n, { label: "Card Number", stripeElement: a, ...t });
313
35
  }
314
- function Re(r) {
315
- return /* @__PURE__ */ w.jsx(L, { label: "Expiration", stripeElement: ke, ...r });
36
+ function h(t) {
37
+ return /* @__PURE__ */ r.jsx(n, { label: "Expiration", stripeElement: E, ...t });
316
38
  }
317
- function Ne(r) {
318
- return /* @__PURE__ */ w.jsx(L, { label: "CVC", stripeElement: Se, ...r });
39
+ function T(t) {
40
+ return /* @__PURE__ */ r.jsx(n, { label: "CVC", stripeElement: s, ...t });
319
41
  }
320
42
  export {
321
- Ne as SStripeCVC,
322
- Re as SStripeExpiry,
323
- Pe as SStripeNumber,
324
- L as StripeTextField
43
+ T as SStripeCVC,
44
+ h as SStripeExpiry,
45
+ j as SStripeNumber,
46
+ n as StripeTextField
325
47
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.45",
6
+ "version": "1.0.46",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "private": false,
9
9
  "type": "module",