@getopenpay/openpay-js 0.5.9 → 0.5.12

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,8 +1,8 @@
1
- import { z as de, p as T, r as _e, w as ye, j as ve, n as he, y as me, dJ as ge, h as Se, dK as Ae, l as Ee, q as Te, i as Pe, m as Re, o as Oe, t as be, u as Ce } from "./url-B-V82H68.js";
2
- import { b as k, t as O, i as Y, T as b, d as Ie, c as B } from "./index-D_vBvWer.js";
3
- import { d as _ } from "./diag-api-BQgG0RgX.js";
1
+ import { z as de, p as T, r as _e, w as ye, j as ve, n as he, y as me, dJ as ge, h as Se, dK as Ae, l as Ee, q as Te, i as Pe, m as Re, o as Oe, t as be, u as Ce } from "./url-WXqZ-_PR.js";
2
+ import { b as k, t as O, i as Y, T as b, d as Ie, c as B } from "./index-DT5HAS-D.js";
3
+ import { d as _ } from "./diag-api-BuzSOOAx.js";
4
4
  import { h as X, E as je } from "./ExportResult-B-YLKMaU.js";
5
- import { D as Me, j as Ne, br as we, bs as De, bt as Le, b as xe, T as Ge, bu as Be, h as Ve, i as Ue, bv as He } from "./sdk-info-rz-T2MNr.js";
5
+ import { D as Me, j as Ne, br as we, bs as De, bt as Le, b as xe, T as Ge, bu as Be, h as Ve, i as Ue, bv as He } from "./sdk-info-B2Z1fEhT.js";
6
6
  import { _ as Ke } from "./utils-CX5YT7yI.js";
7
7
  var p;
8
8
  (function(e) {
@@ -1,7 +1,7 @@
1
- import { R as u } from "./index-D_vBvWer.js";
2
- import { B as c } from "./SimpleSpanProcessor-CawKbjQf.js";
3
- import { A as g, b as x, a as S, C as b, F as w, I as P, N as C, P as T, R as O, d as M, S as A, e as E, c as R, T as N } from "./SimpleSpanProcessor-CawKbjQf.js";
4
- import { P as F, a as j, b as k, g as I, c as W, h as U, n as X, p as z, s as D, d as G } from "./utils-Bcm865JD.js";
1
+ import { R as u } from "./index-DT5HAS-D.js";
2
+ import { B as c } from "./SimpleSpanProcessor-CKDfef5-.js";
3
+ import { A as g, b as x, a as S, C as b, F as w, I as P, N as C, P as T, R as O, d as M, S as A, e as E, c as R, T as N } from "./SimpleSpanProcessor-CKDfef5-.js";
4
+ import { P as F, a as j, b as k, g as I, c as W, h as U, n as X, p as z, s as D, d as G } from "./utils-CkxL0WCq.js";
5
5
  var l = function(n, r) {
6
6
  var e = typeof Symbol == "function" && n[Symbol.iterator];
7
7
  if (!e) return n;
@@ -1,4 +1,4 @@
1
- import { A as r, b as e, B as o, a as p, C as n, F as S, I as c, N as l, P as m, R as t, d, S as i, e as P, c as B, T as I } from "./SimpleSpanProcessor-CawKbjQf.js";
1
+ import { A as r, b as e, B as o, a as p, C as n, F as S, I as c, N as l, P as m, R as t, d, S as i, e as P, c as B, T as I } from "./SimpleSpanProcessor-CKDfef5-.js";
2
2
  export {
3
3
  r as AlwaysOffSampler,
4
4
  e as AlwaysOnSampler,
package/dist/index.d.ts CHANGED
@@ -92,6 +92,34 @@ declare type ApplePayPaymentRequest =
92
92
  | ((current: ApplePayJS.ApplePayPaymentRequest) => Partial<ApplePayJS.ApplePayPaymentRequest>)
93
93
  | Partial<ApplePayJS.ApplePayPaymentRequest>;
94
94
 
95
+ /**
96
+ * Styles
97
+ */
98
+ declare const BaseElementsStyle = z.object({
99
+ backgroundColor: OptionalString,
100
+ color: OptionalString,
101
+ fontFamily: OptionalString,
102
+ fontSize: OptionalString,
103
+ fontWeight: OptionalString,
104
+ margin: OptionalString,
105
+ padding: OptionalString,
106
+ letterSpacing: OptionalString,
107
+ lineHeight: OptionalString,
108
+ hideIcon: OptionalString,
109
+ placeholderStyle: z
110
+ .object({
111
+ color: OptionalString,
112
+ fontSize: OptionalString,
113
+ fontWeight: OptionalString,
114
+ fontFamily: OptionalString,
115
+ letterSpacing: OptionalString,
116
+ lineHeight: OptionalString,
117
+ })
118
+ .optional(),
119
+ });
120
+
121
+ declare type BaseElementsStyle = z.infer<typeof BaseElementsStyle>;
122
+
95
123
  declare enum Blockchain {
96
124
  EVM = 'EVM',
97
125
  SOL = 'Solana',
@@ -99,6 +127,41 @@ declare enum Blockchain {
99
127
 
100
128
  declare type BlockchainNetwork = keyof typeof Blockchain;
101
129
 
130
+ declare const CardCvcElementStyle = BaseElementsStyle.extend({
131
+ disableAutoFill: OptionalString,
132
+ placeholder: z.string().optional(),
133
+ });
134
+
135
+ declare const CardElementStyle = BaseElementsStyle.extend({
136
+ disableAutoFill: OptionalString,
137
+ placeholder: z
138
+ .object({
139
+ cardNumber: OptionalString,
140
+ expiry: OptionalString,
141
+ cvc: OptionalString,
142
+ })
143
+ .optional(),
144
+ });
145
+
146
+ declare const CardExpiryElementStyle = BaseElementsStyle.extend({
147
+ disableAutoFill: OptionalString,
148
+ placeholder: z.string().optional(),
149
+ });
150
+
151
+ declare const CardNumberElementStyle = BaseElementsStyle.extend({
152
+ disableAutoFill: OptionalString,
153
+ placeholder: z.string().optional(),
154
+ /**
155
+ * The card icon at the start of the card number input field
156
+ * It won't affect after the icon changed to card brand after the user input the card number
157
+ */
158
+ icon: z
159
+ .object({
160
+ color: z.string().optional(),
161
+ })
162
+ .optional(),
163
+ });
164
+
102
165
  declare type CCSubmitParams = {
103
166
  paymentRouteId?: string;
104
167
  };
@@ -203,8 +266,8 @@ declare type DefaultFieldValues = Partial<Record<FieldNameEnum, string>> & {
203
266
  require_full_shipping_address?: boolean;
204
267
  };
205
268
 
206
- declare type ElementProps<PlaceholderType extends z.ZodTypeAny = z.ZodString> = {
207
- styles?: ElementsStyle<z.ZodOptional<PlaceholderType>>;
269
+ declare type ElementProps<T extends ElementType> = {
270
+ styles?: ElementsStyle<T>;
208
271
  };
209
272
 
210
273
  declare type ElementsFormProps = {
@@ -221,28 +284,17 @@ declare type ElementsFormProps = {
221
284
  preventNavigationDuringSubmission?: boolean;
222
285
  };
223
286
 
224
- declare const ElementsStyle = <T extends z.ZodTypeAny>(placeholderType: T) =>
225
- BaseElementsStyle.extend({
226
- placeholder: placeholderType,
227
- placeholderStyle: z
228
- .object({
229
- color: OptionalString,
230
- fontSize: OptionalString,
231
- fontWeight: OptionalString,
232
- fontFamily: OptionalString,
233
- letterSpacing: OptionalString,
234
- lineHeight: OptionalString,
235
- })
236
- .optional(),
237
- });
238
-
239
- declare type ElementsStyle<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof ElementsStyle<T>>>;
240
-
241
- declare const ElementType = z.nativeEnum(ElementTypeEnum);
287
+ declare type ElementsStyle<T extends ElementType = ElementType> = {
288
+ card: z.infer<typeof CardElementStyle>;
289
+ 'card-number': z.infer<typeof CardNumberElementStyle>;
290
+ 'card-expiry': z.infer<typeof CardExpiryElementStyle>;
291
+ 'card-cvc': z.infer<typeof CardCvcElementStyle>;
292
+ 'cde-bridge': z.infer<typeof BaseElementsStyle>;
293
+ }[T];
242
294
 
243
- declare type ElementType = z.infer<typeof ElementType>;
295
+ export declare type ElementType = z.infer<typeof _ElementTypeEnumZod>;
244
296
 
245
- declare enum ElementTypeEnum {
297
+ export declare enum ElementTypeEnum {
246
298
  CARD = 'card',
247
299
  CARD_NUMBER = 'card-number',
248
300
  CARD_EXPIRY = 'card-expiry',
@@ -250,7 +302,7 @@ declare enum ElementTypeEnum {
250
302
  CDE_BRIDGE = 'cde-bridge',
251
303
  }
252
304
 
253
- declare type ElementTypeEnumValue = ElementTypeEnum[keyof ElementTypeEnum];
305
+ declare const _ElementTypeEnumZod = z.enum(['card', 'card-number', 'card-expiry', 'card-cvc', 'cde-bridge']);
254
306
 
255
307
  declare enum Environment {
256
308
  Local = 'local',
@@ -783,7 +835,8 @@ declare type OnCheckoutSuccess = (
783
835
  invoiceUrls: string[],
784
836
  subscriptionIds: string[],
785
837
  customerId: string,
786
- processorsUsed: string[]
838
+ processorsUsed: string[],
839
+ paymentMethodId: string
787
840
  ) => void;
788
841
 
789
842
  declare type OnSetupPaymentMethodSuccess = (paymentMethodId: string) => void;
@@ -883,8 +936,8 @@ export declare class OpenPayForm {
883
936
  setFormHeight: (height: string) => void;
884
937
  onCdeLoaded: (payload: LoadedEventPayload) => void;
885
938
  onCdeLoadError: (errMsg: string) => void;
886
- createElement: (elementValue: ElementTypeEnumValue, options?: ElementProps) => RegisteredElement;
887
- registerIframe: (type: ElementTypeEnum, frame: HTMLIFrameElement) => RegisteredElement;
939
+ createElement: <T extends ElementType>(elementType: T, options?: ElementProps<T>) => RegisteredElement;
940
+ registerIframe: (type: ElementType, frame: HTMLIFrameElement) => RegisteredElement;
888
941
  private buildQueryString;
889
942
  private connectToElement;
890
943
  private getFormDiv;
@@ -902,7 +955,13 @@ export declare class OpenPayForm {
902
955
  processors: PaymentProcessor[];
903
956
  isAvailable: boolean;
904
957
  }[]>;
958
+ /**
959
+ * @deprecated
960
+ * We're normalizing the submit method to be the same in both React and Vanilla versions.
961
+ * Please use `submitWith` instead.
962
+ */
905
963
  generalSubmit: GeneralSubmit;
964
+ submitWith: GeneralSubmit;
906
965
  /**
907
966
  * Alias for submitCard
908
967
  */
@@ -1056,6 +1115,7 @@ declare type PaypalFlowCustomParams = {
1056
1115
  };
1057
1116
 
1058
1117
  declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMethod> = {
1118
+ [SubmitMethods.card]: CCSubmitParams;
1059
1119
  [SubmitMethods.pockytPaypal]: { useRedirectFlow?: boolean };
1060
1120
  [SubmitMethods.applePay]: ApplePayFlowCustomParams;
1061
1121
  [SubmitMethods.googlePay]: GooglePayFlowCustomParams;
@@ -1099,6 +1159,7 @@ declare const SubmitMethod = z.nativeEnum(SubmitMethods);
1099
1159
  declare type SubmitMethod = z.infer<typeof SubmitMethod>;
1100
1160
 
1101
1161
  export declare enum SubmitMethods {
1162
+ card = 'card',
1102
1163
  pockytPaypal = 'pockyt-paypal',
1103
1164
  applePay = 'apple-pay',
1104
1165
  googlePay = 'google-pay',
package/dist/index.es.js CHANGED
@@ -1,10 +1,11 @@
1
- import { F as e, O as i, l as p } from "./index-D_vBvWer.js";
1
+ import { E as p, F as r, O as i, l as s } from "./index-DT5HAS-D.js";
2
2
  import "penpal";
3
3
  import "uuid";
4
4
  import "zod";
5
5
  export {
6
- e as FieldName,
6
+ p as ElementTypeEnum,
7
+ r as FieldName,
7
8
  i as OpenPayForm,
8
- p as SubmitMethods
9
+ s as SubmitMethods
9
10
  };
10
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiaW5kZXguZXMuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImV4cG9ydCB7IEYgYXMgRmllbGROYW1lLCBPIGFzIE9wZW5QYXlGb3JtLCBsIGFzIFN1Ym1pdE1ldGhvZHMgfSBmcm9tICcuL2luZGV4LSF+ezAwNn1+LmpzJztcbmltcG9ydCAncGVucGFsJztcbmltcG9ydCAndXVpZCc7XG5pbXBvcnQgJ3pvZCc7Il0sCiAgIm1hcHBpbmdzIjogIkFBQUEsU0FBYyxLQUFMQSxHQUFxQixLQUFMQyxHQUF1QixLQUFMQyxTQUEwQjtBQUNyRSxPQUFPO0FBQ1AsT0FBTztBQUNQLE9BQU87IiwKICAibmFtZXMiOiBbIkYiLCAiTyIsICJsIl0KfQo=
11
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiaW5kZXguZXMuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImV4cG9ydCB7IEUgYXMgRWxlbWVudFR5cGVFbnVtLCBGIGFzIEZpZWxkTmFtZSwgTyBhcyBPcGVuUGF5Rm9ybSwgbCBhcyBTdWJtaXRNZXRob2RzIH0gZnJvbSAnLi9pbmRleC0hfnswMDZ9fi5qcyc7XG5pbXBvcnQgJ3BlbnBhbCc7XG5pbXBvcnQgJ3V1aWQnO1xuaW1wb3J0ICd6b2QnOyJdLAogICJtYXBwaW5ncyI6ICJBQUFBLFNBQWMsS0FBTEEsR0FBMkIsS0FBTEMsR0FBcUIsS0FBTEMsR0FBdUIsS0FBTEMsU0FBMEI7QUFDM0YsT0FBTztBQUNQLE9BQU87QUFDUCxPQUFPOyIsCiAgIm5hbWVzIjogWyJFIiwgIkYiLCAiTyIsICJsIl0KfQo=