@apolopay-sdk/svelte 1.0.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.
- package/README.md +65 -0
- package/dist/ApoloPayButton.svelte +25 -0
- package/dist/ApoloPayButton.svelte.d.ts +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @apolopay-sdk/svelte
|
|
2
|
+
|
|
3
|
+
Svelte wrapper for the Apolo Pay SDK. Provides a component to integrate the Apolo Pay payment button into Svelte applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @apolopay-sdk/svelte
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @apolopay-sdk/svelte
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { ApoloPayButton, ApoloPayClient, type ClientResponse, type ClientError } from '@apolopay-sdk/svelte';
|
|
18
|
+
|
|
19
|
+
// 1. Initialize the client
|
|
20
|
+
const client = new ApoloPayClient({
|
|
21
|
+
publicKey: 'pk_test_...',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const processId = 'your-process-id';
|
|
25
|
+
|
|
26
|
+
// 2. Event handlers
|
|
27
|
+
function handleSuccess(event: CustomEvent<ClientResponse>) {
|
|
28
|
+
console.log('Payment success!', event.detail);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleError(event: CustomEvent<ClientError>) {
|
|
32
|
+
console.error('Payment error!', event.detail);
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<main>
|
|
37
|
+
<h1>My Svelte Store</h1>
|
|
38
|
+
|
|
39
|
+
<!-- 3. Use the component -->
|
|
40
|
+
<ApoloPayButton
|
|
41
|
+
{client}
|
|
42
|
+
{processId}
|
|
43
|
+
productTitle="Order #SVELTE-1"
|
|
44
|
+
lang="es"
|
|
45
|
+
on:success={handleSuccess}
|
|
46
|
+
on:error={handleError}
|
|
47
|
+
barrierDismissible={true}
|
|
48
|
+
/>
|
|
49
|
+
</main>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Props and Events
|
|
53
|
+
|
|
54
|
+
- `client`: (ApoloPayClient) **Required**.
|
|
55
|
+
- `processId`: (string) **Required**.
|
|
56
|
+
- `productTitle`: (string)
|
|
57
|
+
- `lang`: ('es' | 'en')
|
|
58
|
+
- `label`: (string)
|
|
59
|
+
- `barrierDismissible`: (boolean)
|
|
60
|
+
- `on:success`: Fired on success.
|
|
61
|
+
- `on:error`: Fired on error.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>import "@apolopay-sdk/ui";
|
|
2
|
+
export let client = void 0;
|
|
3
|
+
export let processId = void 0;
|
|
4
|
+
export let productTitle = void 0;
|
|
5
|
+
export let lang = void 0;
|
|
6
|
+
export let disabled = false;
|
|
7
|
+
export let loading = false;
|
|
8
|
+
export let label = void 0;
|
|
9
|
+
export let barrierDismissible = false;
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<apolopay-button
|
|
13
|
+
client={client}
|
|
14
|
+
process-id={processId}
|
|
15
|
+
product-title={productTitle}
|
|
16
|
+
{lang}
|
|
17
|
+
{disabled}
|
|
18
|
+
{loading}
|
|
19
|
+
{label}
|
|
20
|
+
barrier-dismissible={barrierDismissible}
|
|
21
|
+
on:success
|
|
22
|
+
on:error
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</apolopay-button>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import "@apolopay-sdk/ui";
|
|
3
|
+
import type { Locale, ApoloPayClient } from "@apolopay-sdk/ui";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
client?: ApoloPayClient | undefined;
|
|
7
|
+
processId?: string | undefined;
|
|
8
|
+
productTitle?: string | undefined;
|
|
9
|
+
lang?: Locale | undefined;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
loading?: boolean | undefined;
|
|
12
|
+
label?: string | undefined;
|
|
13
|
+
barrierDismissible?: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
success: Event | UIEvent | AnimationEvent | MouseEvent | InputEvent | FocusEvent | CompositionEvent | ClipboardEvent | DragEvent | ErrorEvent | FormDataEvent | PointerEvent | KeyboardEvent | ProgressEvent<EventTarget> | SecurityPolicyViolationEvent | SubmitEvent | TouchEvent | TransitionEvent | WheelEvent;
|
|
17
|
+
error: ErrorEvent;
|
|
18
|
+
} & {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {
|
|
22
|
+
default: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ApoloPayButtonProps = typeof __propDef.props;
|
|
26
|
+
export type ApoloPayButtonEvents = typeof __propDef.events;
|
|
27
|
+
export type ApoloPayButtonSlots = typeof __propDef.slots;
|
|
28
|
+
export default class ApoloPayButton extends SvelteComponentTyped<ApoloPayButtonProps, ApoloPayButtonEvents, ApoloPayButtonSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apolopay-sdk/svelte",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Botón de pago de Tu Plataforma para Svelte",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"svelte": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@apolopay-sdk/ui": "1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@sveltejs/package": "2.0.0",
|
|
18
|
+
"@sveltejs/vite-plugin-svelte": "3.0.0",
|
|
19
|
+
"@tsconfig/svelte": "5.0.0",
|
|
20
|
+
"svelte": "4.0.0",
|
|
21
|
+
"svelte-check": "3.0.0",
|
|
22
|
+
"tslib": "2.0.0",
|
|
23
|
+
"typescript": "5.4.5"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"svelte": "3.0.0 || 4.0.0 || 5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"svelte": "./dist/index.js",
|
|
32
|
+
"import": "./dist/index.mjs",
|
|
33
|
+
"require": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "svelte-package",
|
|
42
|
+
"dev": "svelte-package --watch",
|
|
43
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
44
|
+
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch"
|
|
45
|
+
}
|
|
46
|
+
}
|