@flash-pay/vue 0.1.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { FlashpayCheckoutProps } from './types';
2
+ declare const _default: import('vue').DefineComponent<FlashpayCheckoutProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FlashpayCheckoutProps> & Readonly<{}>, {
3
+ showTitle: boolean;
4
+ showDescription: boolean;
5
+ showAmount: boolean;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
7
+ containerRef: HTMLDivElement;
8
+ }, HTMLDivElement>;
9
+ export default _default;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),i=require("@flash-pay/browser-sdk"),f=o.defineComponent({__name:"FlashpayCheckout",props:{transactionId:{},onSuccess:{},onFailure:{},onClose:{},showTitle:{type:Boolean,default:!1},showDescription:{type:Boolean,default:!1},showAmount:{type:Boolean,default:!1},style:{},origin:{}},setup(u){const e=u,s=o.ref(null);let t=null;const l=o.ref(e.onSuccess),a=o.ref(e.onFailure),c=o.ref(e.onClose);o.watch(()=>e.onSuccess,n=>{l.value=n}),o.watch(()=>e.onFailure,n=>{a.value=n}),o.watch(()=>e.onClose,n=>{c.value=n});function r(){t?.destroy(),t=null,s.value&&(t=i.checkout({transactionId:e.transactionId,container:s.value,showTitle:e.showTitle,showDescription:e.showDescription,showAmount:e.showAmount,style:e.style,origin:e.origin,onSuccess:n=>l.value?.(n),onFailure:n=>a.value?.(n),onClose:n=>c.value?.(n)}))}return o.onMounted(r),o.watch(()=>e.transactionId,r),o.onUnmounted(()=>{t?.destroy(),t=null}),(n,h)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:s},null,512))}});exports.FlashpayCheckout=f;
@@ -0,0 +1,3 @@
1
+ export { default as FlashpayCheckout } from './FlashpayCheckout.vue';
2
+ export type { FlashpayCheckoutProps } from './types';
3
+ export type { PaymentEventData, PaymentData } from '@flash-pay/browser-sdk';
@@ -0,0 +1,51 @@
1
+ import { defineComponent as f, ref as t, watch as s, onMounted as p, onUnmounted as h, openBlock as d, createElementBlock as m } from "vue";
2
+ import { checkout as y } from "@flash-pay/browser-sdk";
3
+ const F = /* @__PURE__ */ f({
4
+ __name: "FlashpayCheckout",
5
+ props: {
6
+ transactionId: {},
7
+ onSuccess: {},
8
+ onFailure: {},
9
+ onClose: {},
10
+ showTitle: { type: Boolean, default: !1 },
11
+ showDescription: { type: Boolean, default: !1 },
12
+ showAmount: { type: Boolean, default: !1 },
13
+ style: {},
14
+ origin: {}
15
+ },
16
+ setup(r) {
17
+ const e = r, l = t(null);
18
+ let n = null;
19
+ const a = t(e.onSuccess), c = t(e.onFailure), u = t(e.onClose);
20
+ s(() => e.onSuccess, (o) => {
21
+ a.value = o;
22
+ }), s(() => e.onFailure, (o) => {
23
+ c.value = o;
24
+ }), s(() => e.onClose, (o) => {
25
+ u.value = o;
26
+ });
27
+ function i() {
28
+ n?.destroy(), n = null, l.value && (n = y({
29
+ transactionId: e.transactionId,
30
+ container: l.value,
31
+ showTitle: e.showTitle,
32
+ showDescription: e.showDescription,
33
+ showAmount: e.showAmount,
34
+ style: e.style,
35
+ origin: e.origin,
36
+ onSuccess: (o) => a.value?.(o),
37
+ onFailure: (o) => c.value?.(o),
38
+ onClose: (o) => u.value?.(o)
39
+ }));
40
+ }
41
+ return p(i), s(() => e.transactionId, i), h(() => {
42
+ n?.destroy(), n = null;
43
+ }), (o, w) => (d(), m("div", {
44
+ ref_key: "containerRef",
45
+ ref: l
46
+ }, null, 512));
47
+ }
48
+ });
49
+ export {
50
+ F as FlashpayCheckout
51
+ };
@@ -0,0 +1,12 @@
1
+ import { PaymentEventData } from '@flash-pay/browser-sdk';
2
+ export interface FlashpayCheckoutProps {
3
+ transactionId: string;
4
+ onSuccess?: (data: PaymentEventData) => void;
5
+ onFailure?: (data: PaymentEventData) => void;
6
+ onClose?: (data: PaymentEventData) => void;
7
+ showTitle?: boolean;
8
+ showDescription?: boolean;
9
+ showAmount?: boolean;
10
+ style?: Partial<CSSStyleDeclaration>;
11
+ origin?: string;
12
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@flash-pay/vue",
3
+ "version": "0.1.0",
4
+ "description": "Vue 3 component for Flashpay checkout",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.es.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.es.js",
11
+ "require": "./dist/index.cjs.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "sideEffects": false,
16
+ "files": ["dist"],
17
+ "scripts": {
18
+ "build": "vite build",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest"
21
+ },
22
+ "peerDependencies": {
23
+ "vue": ">=3.3",
24
+ "@flash-pay/browser-sdk": "*"
25
+ },
26
+ "devDependencies": {
27
+ "@flash-pay/browser-sdk": "workspace:*",
28
+ "@vitejs/plugin-vue": "^5.2.4",
29
+ "@vue/test-utils": "^2.4.6",
30
+ "vite": "^7.3.1",
31
+ "vite-plugin-dts": "^4.5.4",
32
+ "vitest": "^3.2.4",
33
+ "jsdom": "^26.1.0",
34
+ "vue": "^3.5.17",
35
+ "typescript": "^5"
36
+ }
37
+ }