@getopenpay/openpay-js 0.2.13-alpha.16b22e4 → 0.2.13

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.d.ts CHANGED
@@ -52,13 +52,6 @@ declare type ApplePayFlowCustomParams = {
52
52
  defaultFieldValues?: DefaultFieldValues;
53
53
  };
54
54
 
55
- declare enum Blockchain {
56
- EVM = 'EVM',
57
- SOL = 'Solana',
58
- }
59
-
60
- declare type BlockchainNetwork = keyof typeof Blockchain;
61
-
62
55
  declare type CdeConnection = {
63
56
  send: (data: CdeMessage) => Promise<unknown>;
64
57
  };
@@ -86,28 +79,6 @@ export declare type Config = ElementsFormProps & AllCallbacks;
86
79
 
87
80
  declare type CurrentStatus<T> = InitialStatus | SuccessStatus<T> | ErrorStatus;
88
81
 
89
- declare interface CustomerResponse {
90
- /**
91
- * The unique identifier that represents the customer
92
- * @example "1234567890abcdef"
93
- */
94
- customerId: string;
95
- /**
96
- * The external customer reference ID used to tie this customer to a customer in an external system.
97
- * @example "1234567890abcdef"
98
- */
99
- customerRefId: string | null;
100
- /**
101
- * The payment methods configured for this customer to make payments with.
102
- */
103
- paymentMethods: Omit<PaymentMethodResponse, 'entityId' | 'customer' | 'dateCreated'>[];
104
- /**
105
- * The date the customer record was created, represented as a Unix timestamp in seconds.
106
- * @example 1716211200
107
- */
108
- dateCreated: number;
109
- }
110
-
111
82
  declare type CustomInitParams = {
112
83
  // You can put custom params for your init flows here
113
84
 
@@ -146,8 +117,6 @@ declare type CustomInitParams = {
146
117
  };
147
118
  };
148
119
 
149
- declare type CustomStyles = string;
150
-
151
120
  declare type DefaultFieldValues = Partial<Record<FieldNameEnum, string>>;
152
121
 
153
122
  declare type ElementProps<PlaceholderType extends z.ZodTypeAny = z.ZodString> = {
@@ -192,14 +161,6 @@ declare enum ElementTypeEnum {
192
161
 
193
162
  declare type ElementTypeEnumValue = ElementTypeEnum[keyof ElementTypeEnum];
194
163
 
195
- declare enum Environment {
196
- Local = 'local',
197
- Development = 'development',
198
- Staging = 'staging',
199
- Demo = 'demo',
200
- Production = 'production',
201
- }
202
-
203
164
  declare type ErrorStatus = {
204
165
  status: 'error';
205
166
  isSuccess: false;
@@ -299,13 +260,6 @@ declare type InitApplePayFlowResult = {
299
260
  startFlow: (customParams?: ApplePayFlowCustomParams) => Promise<void>;
300
261
  };
301
262
 
302
- declare interface InitFailedEvent {
303
- type: 'initFailed';
304
- message: string;
305
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
306
- data: Record<string, any>;
307
- }
308
-
309
263
  declare type InitGooglePayFlowResult = {
310
264
  processor: PaymentProcessor;
311
265
  isAvailable: boolean;
@@ -313,25 +267,11 @@ declare type InitGooglePayFlowResult = {
313
267
  startFlow: (customParams?: GooglePayFlowCustomParams) => Promise<void>;
314
268
  };
315
269
 
316
- declare interface InitializedEvent {
317
- entityId: string;
318
- }
319
-
320
270
  declare type InitialStatus = {
321
271
  status: 'initial';
322
272
  isSuccess: false;
323
273
  };
324
274
 
325
- declare type InitLoopCryptoFlowSuccess =
326
- | {
327
- isAvailable: true;
328
- widgetProps: LoopCryptoWidgetProps;
329
- initLoopConnectProps: LoopConnectConfig;
330
- }
331
- | {
332
- isAvailable: false;
333
- };
334
-
335
275
  declare type InitOjsFlow<T extends InitOjsFlowResult> = (params: InitOjsFlowParams) => Promise<T>;
336
276
 
337
277
  declare type InitOjsFlowParams = {
@@ -479,51 +419,6 @@ declare class LoadedOncePublisher<T> {
479
419
  };
480
420
  }
481
421
 
482
- declare interface LoopConnectConfig {
483
- apiKey: string;
484
- entityId: string;
485
- merchantId?: string;
486
- environment?: Environment | `${Environment}`;
487
- customStyles?: CustomStyles;
488
- onInitialized?: (detail: InitializedEvent) => void;
489
- onInitFailed?: (detail: InitFailedEvent) => void;
490
- onWalletChange?: (detail: WalletChangeEvent) => void;
491
- onNetworkChange?: (detail: NetworkChangeEvent) => void;
492
- }
493
-
494
- declare type LoopCryptoFlowCustomParams =
495
- | {
496
- customer: Omit<CustomerResponse, 'paymentMethods' | 'merchants' | 'dateCreated'>;
497
- payin: PayInCompleteEvent;
498
- // TODO: Move these to nonCdeFormInput prop
499
- email?: string;
500
- firstName?: string;
501
- lastName?: string;
502
- success: true;
503
- }
504
- | {
505
- detail: PayInFailedEvent;
506
- // TODO: Move these to nonCdeFormInput prop
507
- email?: string;
508
- firstName?: string;
509
- lastName?: string;
510
- success: false;
511
- };
512
-
513
- declare type LoopCryptoWidgetProps = {
514
- paymentUsdAmount: number;
515
- suggestedAuthorizationUsdAmount: number;
516
- subscriptionRefId?: string;
517
- customerRefId?: string;
518
- invoiceRefId?: string;
519
- };
520
-
521
- declare interface NetworkChangeEvent {
522
- id: number;
523
- name: string;
524
- chain: BlockchainNetwork;
525
- }
526
-
527
422
  declare type OjsContext = {
528
423
  /**
529
424
  * The secure token for the checkout session.
@@ -634,12 +529,6 @@ declare const OjsFlows = {
634
529
  run: runAirwallexApplePayFlow,
635
530
  },
636
531
 
637
- // Loop
638
- loopCrypto: {
639
- init: initLoopFlow,
640
- run: runLoopFlow,
641
- },
642
-
643
532
  authorizeNetApplePay: {
644
533
  init: initAuthnetApplePayFlow,
645
534
  run: runAuthnetApplePayFlow,
@@ -700,10 +589,6 @@ export declare class OpenPayForm {
700
589
  publisher: LoadedOncePublisher<InitApplePayFlowResult>;
701
590
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
702
591
  };
703
- readonly loop: {
704
- publisher: LoadedOncePublisher<InitLoopCryptoFlowSuccess>;
705
- initialize: (initParams: InitOjsFlowParams) => Promise<void>;
706
- };
707
592
  readonly authorizeNetGooglePay: {
708
593
  publisher: LoadedOncePublisher<InitGooglePayFlowResult>;
709
594
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
@@ -774,11 +659,6 @@ export declare class OpenPayForm {
774
659
  } | {
775
660
  isAvailable: false;
776
661
  name: string;
777
- } | {
778
- isAvailable: true;
779
- widgetProps: LoopCryptoWidgetProps;
780
- initLoopConnectProps: LoopConnectConfig;
781
- name: string;
782
662
  })[] | undefined;
783
663
  generalSubmit: <T extends SubmitMethod>(method: T, settings?: SubmitSettings<T>) => Promise<void> | undefined;
784
664
  /**
@@ -792,224 +672,8 @@ export declare class OpenPayForm {
792
672
  updateCallbacks: (newCallbacks: AllCallbacks) => void;
793
673
  }
794
674
 
795
- /**
796
- * @deprecated Use interface PayInCreatedEvent for data returned from the creation of a PayIn
797
- */
798
- declare interface PayInCompleteEvent extends PayinResponse {}
799
-
800
- declare enum PayInFailed {
801
- INSUFFICIENT_BALANCE = 'insufficientBalance',
802
- INSUFFICIENT_AUTHORIZATION = 'insufficientAuthorization',
803
- SIGNED_MESSAGE_REQUIRED = 'signedMessageRequired',
804
- CUSTOMER_CREATION_FAILED = 'customerCreationFailed',
805
- PAYMENT_FAILED = 'paymentFailed',
806
- TRANSACTION_FAILED = 'transactionFailed',
807
- }
808
-
809
- declare interface PayInFailedData {
810
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
811
- error: Record<string, any> | undefined;
812
- }
813
-
814
- declare interface PayInFailedEvent {
815
- type: PayInFailed;
816
- message: string;
817
- data: PayInFailedData;
818
- }
819
-
820
- declare interface PayinPaymentMethodResponse
821
- extends Omit<PaymentMethodResponse, 'merchantId' | 'entityId' | 'dateCreated'> {
822
- /**
823
- * The status of the payment method
824
- */
825
- status: 'ok' | 'insufficient_balance' | 'insufficient_authorization' | 'insufficient_balance_authorization';
826
- }
827
-
828
- declare interface PayinPayoutDestinationResponse
829
- extends Omit<PayoutDestinationResponse, 'merchantId' | 'entityId' | 'isDefault' | 'dateCreated'> {}
830
-
831
- declare interface PayinResponse {
832
- /**
833
- * The unique identifier for the payin
834
- * @example "8f47c6e9-2b3a-4d5c-9f8e-1a2b3c4d5e6f"
835
- */
836
- payinId: string;
837
- /**
838
- * The unique identifier of the merchant this payin is associated with
839
- * @example "67e55044-10b1-426f-9247-bb680e5fe0c8"
840
- */
841
- merchantId: string;
842
- /**
843
- * The amount to be paid, specified in either fiat or crypto based on amountType
844
- * @example "100.00"
845
- */
846
- amount: string;
847
- /**
848
- * The type of the amount, either "fiat" or "token"
849
- * @example "fiat"
850
- */
851
- amountType: 'fiat' | 'token';
852
- /**
853
- * The date the payment will take place, represented as a Unix timestamp
854
- * @example 1716211200
855
- */
856
- billDate: number;
857
- /**
858
- * The unique invoice identifier representing this payin transaction
859
- * @example "1234567890abcdef"
860
- */
861
- invoiceId: string;
862
- /**
863
- * (Optional) A description or note that provides additional context about this payin. This can be used to help identify or provide details about the payment for internal reference or customer communications.
864
- * @example "Payment for Developer plan"
865
- */
866
- description: string | null;
867
- /**
868
- * (Optional) The external invoice ID used to tie this payin to an invoice in an external system
869
- * @example "1234567890abcdef"
870
- */
871
- externalInvoiceRef: string | null;
872
- /**
873
- * The type of the payin, either "subscription" or "invoice"
874
- * @example "subscription"
875
- */
876
- payinType: 'subscription' | 'invoice';
877
- /**
878
- * The status of the payin, can be "scheduled", "pending", "completed", or "failed"
879
- * @example "scheduled"
880
- */
881
- payinStatus: 'scheduled' | 'pending' | 'completed' | 'failed' | 'canceled' | 'uncollectible' | 'draft';
882
- /**
883
- * The transaction details for the payin
884
- */
885
- transaction: PayinTransactionResponse | null;
886
- /**
887
- * The payment method used for this payin
888
- */
889
- paymentMethod: PayinPaymentMethodResponse;
890
- /**
891
- * The payout destination used for this payin
892
- */
893
- payoutDestination: PayinPayoutDestinationResponse;
894
- /**
895
- * The date the payin record was created, represented as a Unix timestamp in seconds.
896
- * @example 1716211200
897
- */
898
- dateCreated: number;
899
- }
900
-
901
- declare interface PayinTransactionResponse {
902
- /**
903
- * The transaction id generated by the blockchain network when the transaction is processed
904
- * @example "0xcfdfbb523c079e47e9a17ba236fa978257d4331e96ec43997e974b97522047fe"
905
- */
906
- transactionId: string;
907
- /**
908
- * The URL to view this transaction in a blockchain explorer. The specific explorer URL depends on the blockchain network the transaction was processed on
909
- * @example "https://etherscan.io/tx/0xcfdfbb523c079e47e9a17ba236fa978257d4331e96ec43997e974b97522047fe"
910
- */
911
- transactionUrl: string;
912
- /**
913
- * The actual token amount that was transferred including all decimal places. For example - an amount of 1.99 USDC will result in a `amountTransferred` of "1990000"
914
- * @example "1990000"
915
- */
916
- amountTransferred: string | null;
917
- /**
918
- * The exchange rate that was applied when the payment was processed on the blockchain
919
- */
920
- exchangeRate: PaymentMethodTokenExchangeRate | null;
921
- }
922
-
923
675
  declare type PaymentDataRequest = google.payments.api.PaymentDataRequest;
924
676
 
925
- declare interface PaymentMethodPreAuthorization {
926
- /**
927
- * The balance of the payment method formatted in the token amount
928
- * @example "100"
929
- */
930
- balance: string;
931
- /**
932
- * The authorization amount of the payment method formatted in the token amount
933
- * @example "49.9"
934
- */
935
- authorization: string;
936
- }
937
-
938
- declare interface PaymentMethodResponse {
939
- /**
940
- * The unique identifier for the payment method
941
- * @example "1234567890abcdef"
942
- */
943
- paymentMethodId: string;
944
- /**
945
- * The unique identifier of the merchant this payment method is associated with
946
- * @example "67e55044-10b1-426f-9247-bb680e5fe0c8"
947
- */
948
- merchantId: string;
949
- /**
950
- * The name of the payment method
951
- * @example "My Crypto Wallet"
952
- */
953
- paymentMethodName: string;
954
- /**
955
- * The customers that are associated with the payment method
956
- */
957
- customer: Omit<CustomerResponse, 'paymentMethods' | 'merchants' | 'dateCreated'>;
958
- /**
959
- * The blockchain network ID the payment method is associated with
960
- * @example 1
961
- */
962
- networkId: number;
963
- /**
964
- * The blockchain wallet address where payments will be sent from
965
- * @example "0x1234567890abcdef"
966
- */
967
- walletAddress: string;
968
- /**
969
- * Whether the payment method is the default payment method for wallet address
970
- * @example true
971
- */
972
- isDefault: boolean;
973
- /**
974
- * The token associated with the payment method
975
- */
976
- token: PaymentMethodToken;
977
- /**
978
- * The status of the payment method, including the wallet's balance and authorization status
979
- */
980
- preAuthorization: PaymentMethodPreAuthorization | null;
981
- /**
982
- * The date the payment method record was created, represented as a Unix timestamp in seconds.
983
- * @example 1716211200
984
- */
985
- dateCreated: number;
986
- }
987
-
988
- declare interface PaymentMethodToken extends Omit<TokenResponse, 'networkId'> {
989
- /**
990
- * The exchange rate of the token
991
- */
992
- exchangeRates: PaymentMethodTokenExchangeRate[];
993
- }
994
-
995
- declare interface PaymentMethodTokenExchangeRate {
996
- /**
997
- * The currency code. Only "USD" is supported at this time.
998
- * @example "USD"
999
- */
1000
- currency: string;
1001
- /**
1002
- * The price of the token in the specified currency code. Accurate to 4 decimal places, e.g. a price of "1.9900" represents $1.99
1003
- * @example "10000"
1004
- */
1005
- price: string;
1006
- /**
1007
- * The Unix timestamp (in seconds) when this exchange rate was last updated
1008
- * @example 1715731200
1009
- */
1010
- timestamp: number;
1011
- }
1012
-
1013
677
  declare const PaymentProcessor = z.enum(['stripe', 'airwallex', 'authorize_net']);
1014
678
 
1015
679
  declare type PaymentProcessor = z.infer<typeof PaymentProcessor>;
@@ -1032,46 +696,12 @@ declare type PaymentRequestStatus = {
1032
696
  startFlow: (params?: PaymentRequestStartParams) => Promise<void>;
1033
697
  };
1034
698
 
1035
- declare interface PayoutDestinationResponse {
1036
- /**
1037
- * The unique identifier for the payout destination
1038
- * @example "1234567890abcdef"
1039
- */
1040
- payoutDestinationId: string;
1041
- /**
1042
- * The merchant ID associated with this payout destination
1043
- * @example "1234567890abcdef"
1044
- */
1045
- merchantId: string;
1046
- /**
1047
- * The blockchain network ID the payout destination is associated with
1048
- * @example 1
1049
- */
1050
- networkId: number;
1051
- /**
1052
- * The blockchain wallet address where payments will be sent. Must be a valid address for the specified network.
1053
- * @example "0x1234567890abcdef"
1054
- */
1055
- walletAddress: string;
1056
- /**
1057
- * Whether the payout destination is the default payout destination for the merchant.
1058
- * @example true
1059
- */
1060
- isDefault: boolean;
1061
- /**
1062
- * The date the payout destination record was created, represented as a Unix timestamp in seconds.
1063
- * @example 1716211200
1064
- */
1065
- dateCreated: number;
1066
- }
1067
-
1068
699
  declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMethod> = {
1069
700
  'pockyt-paypal': { useRedirectFlow?: boolean };
1070
701
  'airwallex-google-pay': GooglePayFlowCustomParams;
1071
702
  'airwallex-apple-pay': ApplePayFlowCustomParams;
1072
703
  'authorizenet-google-pay': GooglePayFlowCustomParams;
1073
704
  'authorizenet-apple-pay': ApplePayFlowCustomParams;
1074
- 'loop-crypto': LoopCryptoFlowCustomParams;
1075
705
  }[T];
1076
706
 
1077
707
  declare type PRStatuses = Record<PaymentRequestProvider, PaymentRequestStatus>;
@@ -1102,7 +732,6 @@ export declare enum SubmitMethods {
1102
732
  airwallexApplePay = 'airwallex-apple-pay',
1103
733
  authorizenetGooglePay = 'authorizenet-google-pay',
1104
734
  authorizenetApplePay = 'authorizenet-apple-pay',
1105
- loopCrypto = 'loop-crypto',
1106
735
  }
1107
736
 
1108
737
  export declare type SubmitSettings<T extends SubmitMethod = SubmitMethod> = ProcessorSpecificSubmitSettings<T> &
@@ -1114,37 +743,4 @@ declare type SuccessStatus<T> = {
1114
743
  loadedValue: T;
1115
744
  };
1116
745
 
1117
- declare interface TokenResponse {
1118
- /**
1119
- * The unique identifier for the token used by the payment type.
1120
- * @example "123e4567-e89b-12d3-a456-426614174000"
1121
- */
1122
- tokenId: string;
1123
- /**
1124
- * The blockchain network ID the token is associated with
1125
- * @example 1
1126
- */
1127
- networkId: number;
1128
- /**
1129
- * The token symbol that identifies the token on the blockchain network
1130
- * @example "USDC"
1131
- */
1132
- symbol: string;
1133
- /**
1134
- * The token contract address for the payment type
1135
- * @example "0x1234567890abcdef"
1136
- */
1137
- address: string;
1138
- /**
1139
- * The number of decimal places used to represent token amounts
1140
- * @example 6
1141
- */
1142
- decimals: number;
1143
- }
1144
-
1145
- declare interface WalletChangeEvent {
1146
- address: string;
1147
- ens: string | undefined;
1148
- }
1149
-
1150
746
  export { }