@ozura/elements 1.2.0-next.38 → 1.2.0-next.39
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 +22 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -796,8 +796,25 @@ Must be called from inside an `<OzElements>` provider tree.
|
|
|
796
796
|
|
|
797
797
|
### Quick start
|
|
798
798
|
|
|
799
|
+
`useOzElements()` calls Vue's `inject()` under the hood, so it must be called from a **child** of `<OzElements>`, not from the same component that renders it. Use two components — an outer wrapper that provides `<OzElements>`, and an inner form component that calls the composable:
|
|
800
|
+
|
|
801
|
+
**CheckoutPage.vue** — renders the provider
|
|
802
|
+
|
|
799
803
|
<script setup lang="ts">
|
|
800
|
-
import { OzElements
|
|
804
|
+
import { OzElements } from '@ozura/elements/vue';
|
|
805
|
+
import CheckoutForm from './CheckoutForm.vue';
|
|
806
|
+
</script>
|
|
807
|
+
|
|
808
|
+
<template>
|
|
809
|
+
<OzElements pub-key="pk_live_..." session-url="/api/oz-session">
|
|
810
|
+
<CheckoutForm />
|
|
811
|
+
</OzElements>
|
|
812
|
+
</template>
|
|
813
|
+
|
|
814
|
+
**CheckoutForm.vue** — child component, calls the composable
|
|
815
|
+
|
|
816
|
+
<script setup lang="ts">
|
|
817
|
+
import { OzCardNumber, OzExpiry, OzCvv, useOzElements } from '@ozura/elements/vue';
|
|
801
818
|
|
|
802
819
|
const { createToken, ready } = useOzElements();
|
|
803
820
|
|
|
@@ -810,12 +827,10 @@ Must be called from inside an `<OzElements>` provider tree.
|
|
|
810
827
|
</script>
|
|
811
828
|
|
|
812
829
|
<template>
|
|
813
|
-
<
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
<button :disabled="!ready" @click="handlePay">Pay</button>
|
|
818
|
-
</OzElements>
|
|
830
|
+
<OzCardNumber @change="(e) => console.log(e.cardBrand)" />
|
|
831
|
+
<OzExpiry />
|
|
832
|
+
<OzCvv />
|
|
833
|
+
<button :disabled="!ready" @click="handlePay">Pay</button>
|
|
819
834
|
</template>
|
|
820
835
|
|
|
821
836
|
### Individual fields
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozura/elements",
|
|
3
|
-
"version": "1.2.0-next.
|
|
3
|
+
"version": "1.2.0-next.39",
|
|
4
4
|
"description": "PCI-compliant card tokenization SDK for the Ozura Vault — collect card data in iframe-isolated fields and tokenize without PCI scope",
|
|
5
5
|
"main": "dist/oz-elements.umd.js",
|
|
6
6
|
"module": "dist/oz-elements.esm.js",
|