@getopenpay/openpay-js 0.5.9 → 0.5.11

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,4 +1,4 @@
1
- import { d as diag } from "./diag-api-BQgG0RgX.js";
1
+ import { d as diag } from "./diag-api-Cz-UtaIj.js";
2
2
  import { E as ExportResultCode, h as hexToBinary } from "./ExportResult-B-YLKMaU.js";
3
3
  import { c as commonjsGlobal } from "./_commonjsHelpers-f76XedMs.js";
4
4
  var OTLPExporterBase = (
@@ -1,9 +1,9 @@
1
- import { d as z } from "./diag-api-BQgG0RgX.js";
2
- import { b as G, c as I, d as W, e as X, p as _, i as V, f as K, g as Q, j as C, k as $, m as J } from "./url-B-V82H68.js";
3
- import { s as Y, i as Z, I as q } from "./utils-Dq30RtPb.js";
1
+ import { d as z } from "./diag-api-Cz-UtaIj.js";
2
+ import { b as G, c as I, d as W, e as X, p as _, i as V, f as K, g as Q, j as C, k as $, m as J } from "./url-Bg17qvHA.js";
3
+ import { s as Y, i as Z, I as q } from "./utils-DUkJ-8r_.js";
4
4
  import { _ as T } from "./utils-CX5YT7yI.js";
5
- import { P as O, b as P, p as N, s as ee, c as te } from "./utils-Bcm865JD.js";
6
- import { t as x, c as p, S as re } from "./index-D_vBvWer.js";
5
+ import { P as O, b as P, p as N, s as ee, c as te } from "./utils-DBqZC8JN.js";
6
+ import { t as x, c as p, S as re } from "./index-CsYu7T8Y.js";
7
7
  var y;
8
8
  (function(a) {
9
9
  a.COMPONENT = "component", a.HTTP_ERROR_NAME = "http.error_name", a.HTTP_STATUS_TEXT = "http.status_text";
@@ -1,4 +1,4 @@
1
- import { R as Le } from "./index-D_vBvWer.js";
1
+ import { R as Le } from "./index-CsYu7T8Y.js";
2
2
  function Et(e) {
3
3
  return e === void 0 && (e = {}), typeof e.addEventListener == "function" && typeof e.removeEventListener == "function";
4
4
  }
@@ -1,7 +1,7 @@
1
- import { R as l } from "./Resource-DdfT9Qgs.js";
2
- import { d as ee } from "./Resource-DdfT9Qgs.js";
3
- import { d as v } from "./diag-api-BQgG0RgX.js";
4
- import { e as A, f as m, g as b, h as w, S as D } from "./sdk-info-rz-T2MNr.js";
1
+ import { R as l } from "./Resource-CmF5dReO.js";
2
+ import { d as ee } from "./Resource-CmF5dReO.js";
3
+ import { d as v } from "./diag-api-Cz-UtaIj.js";
4
+ import { e as A, f as m, g as b, h as w, S as D } from "./sdk-info-CqjfNdA7.js";
5
5
  var T = (
6
6
  /** @class */
7
7
  function() {
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',
@@ -883,8 +935,8 @@ export declare class OpenPayForm {
883
935
  setFormHeight: (height: string) => void;
884
936
  onCdeLoaded: (payload: LoadedEventPayload) => void;
885
937
  onCdeLoadError: (errMsg: string) => void;
886
- createElement: (elementValue: ElementTypeEnumValue, options?: ElementProps) => RegisteredElement;
887
- registerIframe: (type: ElementTypeEnum, frame: HTMLIFrameElement) => RegisteredElement;
938
+ createElement: <T extends ElementType>(elementType: T, options?: ElementProps<T>) => RegisteredElement;
939
+ registerIframe: (type: ElementType, frame: HTMLIFrameElement) => RegisteredElement;
888
940
  private buildQueryString;
889
941
  private connectToElement;
890
942
  private getFormDiv;
@@ -902,7 +954,13 @@ export declare class OpenPayForm {
902
954
  processors: PaymentProcessor[];
903
955
  isAvailable: boolean;
904
956
  }[]>;
957
+ /**
958
+ * @deprecated
959
+ * We're normalizing the submit method to be the same in both React and Vanilla versions.
960
+ * Please use `submitWith` instead.
961
+ */
905
962
  generalSubmit: GeneralSubmit;
963
+ submitWith: GeneralSubmit;
906
964
  /**
907
965
  * Alias for submitCard
908
966
  */
@@ -1056,6 +1114,7 @@ declare type PaypalFlowCustomParams = {
1056
1114
  };
1057
1115
 
1058
1116
  declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMethod> = {
1117
+ [SubmitMethods.card]: CCSubmitParams;
1059
1118
  [SubmitMethods.pockytPaypal]: { useRedirectFlow?: boolean };
1060
1119
  [SubmitMethods.applePay]: ApplePayFlowCustomParams;
1061
1120
  [SubmitMethods.googlePay]: GooglePayFlowCustomParams;
@@ -1099,6 +1158,7 @@ declare const SubmitMethod = z.nativeEnum(SubmitMethods);
1099
1158
  declare type SubmitMethod = z.infer<typeof SubmitMethod>;
1100
1159
 
1101
1160
  export declare enum SubmitMethods {
1161
+ card = 'card',
1102
1162
  pockytPaypal = 'pockyt-paypal',
1103
1163
  applePay = 'apple-pay',
1104
1164
  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-CsYu7T8Y.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=