@riskdefy/chargebacks 1.0.0 → 1.0.1

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,24 +1,58 @@
1
- import { createElementBlock as s, openBlock as r, createElementVNode as o } from "vue";
2
- const l = (e, t) => {
3
- const a = e.__vccOpts || e;
4
- for (const [n, c] of t)
5
- a[n] = c;
6
- return a;
7
- }, p = {
8
- name: "Chargebacks"
9
- }, d = { class: "chargebacks" };
10
- function _(e, t, a, n, c, k) {
11
- return r(), s("div", d, t[0] || (t[0] = [
12
- o("h2", null, "Chargebacks Component", -1),
13
- o("p", null, "Displaying chargeback data...", -1)
14
- ]));
1
+ import { createElementBlock as s, openBlock as c, createElementVNode as i, createCommentVNode as d, toDisplayString as h } from "vue";
2
+ const l = (t, e) => {
3
+ const r = t.__vccOpts || t;
4
+ for (const [a, n] of e)
5
+ r[a] = n;
6
+ return r;
7
+ }, m = {
8
+ props: {
9
+ apiKey: {
10
+ type: String,
11
+ required: !0
12
+ },
13
+ merchantId: {
14
+ type: String,
15
+ required: !0
16
+ }
17
+ },
18
+ data() {
19
+ return { data: null };
20
+ },
21
+ methods: {
22
+ async fetchChargebacks() {
23
+ try {
24
+ const t = { merchantId: this.merchantId }, e = new URISearchParams(t).toString(), a = await (await fetch(
25
+ `https://api.riskdefy.io/chargebacks?${e}`,
26
+ {
27
+ method: "GET",
28
+ headers: {
29
+ Authorization: `Bearer ${this.apiKey}`,
30
+ "Content-Type": "application/json"
31
+ }
32
+ }
33
+ )).json();
34
+ this.data = a;
35
+ } catch (t) {
36
+ console.error("API Error:", t);
37
+ }
38
+ }
39
+ }
40
+ }, u = { key: 0 };
41
+ function g(t, e, r, a, n, o) {
42
+ return c(), s("div", null, [
43
+ e[1] || (e[1] = i("h2", null, "Chargebacks Report", -1)),
44
+ i("button", {
45
+ onClick: e[0] || (e[0] = (...p) => o.fetchChargebacks && o.fetchChargebacks(...p))
46
+ }, "Load Report"),
47
+ n.data ? (c(), s("pre", u, h(n.data), 1)) : d("", !0)
48
+ ]);
15
49
  }
16
- const i = /* @__PURE__ */ l(p, [["render", _], ["__scopeId", "data-v-dc14aa5f"]]), g = {
17
- install(e) {
18
- e.component("Chargebacks", i);
50
+ const k = /* @__PURE__ */ l(m, [["render", g]]), y = {
51
+ install(t) {
52
+ t.component("Chargebacks", k);
19
53
  }
20
54
  };
21
55
  export {
22
- i as Chargebacks,
23
- g as default
56
+ k as Chargebacks,
57
+ y as default
24
58
  };
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.Chargebacks={},e.Vue))})(this,function(e,t){"use strict";const d=(n,o)=>{const a=n.__vccOpts||n;for(const[c,r]of o)a[c]=r;return a},i={name:"Chargebacks"},l={class:"chargebacks"};function u(n,o,a,c,r,p){return t.openBlock(),t.createElementBlock("div",l,o[0]||(o[0]=[t.createElementVNode("h2",null,"Chargebacks Component",-1),t.createElementVNode("p",null,"Displaying chargeback data...",-1)]))}const s=d(i,[["render",u],["__scopeId","data-v-dc14aa5f"]]),f={install(n){n.component("Chargebacks",s)}};e.Chargebacks=s,e.default=f,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.Chargebacks={},r.Vue))})(this,function(r,e){"use strict";const d=(t,n)=>{const o=t.__vccOpts||t;for(const[a,s]of n)o[a]=s;return o},p={props:{apiKey:{type:String,required:!0},merchantId:{type:String,required:!0}},data(){return{data:null}},methods:{async fetchChargebacks(){try{const t={merchantId:this.merchantId},n=new URISearchParams(t).toString(),a=await(await fetch(`https://api.riskdefy.io/chargebacks?${n}`,{method:"GET",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}})).json();this.data=a}catch(t){console.error("API Error:",t)}}}},h={key:0};function l(t,n,o,a,s,i){return e.openBlock(),e.createElementBlock("div",null,[n[1]||(n[1]=e.createElementVNode("h2",null,"Chargebacks Report",-1)),e.createElementVNode("button",{onClick:n[0]||(n[0]=(...f)=>i.fetchChargebacks&&i.fetchChargebacks(...f))},"Load Report"),s.data?(e.openBlock(),e.createElementBlock("pre",h,e.toDisplayString(s.data),1)):e.createCommentVNode("",!0)])}const c=d(p,[["render",l]]),u={install(t){t.component("Chargebacks",c)}};r.Chargebacks=c,r.default=u,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riskdefy/chargebacks",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Chargebacks Vue component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,18 +1,47 @@
1
1
  <template>
2
- <div class="chargebacks">
3
- <h2>Chargebacks Component</h2>
4
- <p>Displaying chargeback data...</p>
2
+ <div>
3
+ <h2>Chargebacks Report</h2>
4
+ <button @click="fetchChargebacks">Load Report</button>
5
+ <pre v-if="data">{{ data }}</pre>
5
6
  </div>
6
7
  </template>
8
+
7
9
  <script>
8
10
  export default {
9
- name: "Chargebacks",
11
+ props: {
12
+ apiKey: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ merchantId: {
17
+ type: String,
18
+ required: true,
19
+ },
20
+ },
21
+ data() {
22
+ return { data: null };
23
+ },
24
+ methods: {
25
+ async fetchChargebacks() {
26
+ try {
27
+ const params = { merchantId: this.merchantId };
28
+ const paramsString = new URISearchParams(params).toString();
29
+ const response = await fetch(
30
+ `https://api.riskdefy.io/chargebacks?${paramsString}`,
31
+ {
32
+ method: "GET",
33
+ headers: {
34
+ Authorization: `Bearer ${this.apiKey}`,
35
+ "Content-Type": "application/json",
36
+ },
37
+ }
38
+ );
39
+ const data = await response.json();
40
+ this.data = data;
41
+ } catch (error) {
42
+ console.error("API Error:", error);
43
+ }
44
+ },
45
+ },
10
46
  };
11
47
  </script>
12
- <style scoped>
13
- .chargebacks {
14
- border: 1px solid #ddd;
15
- padding: 10px;
16
- border-radius: 5px;
17
- }
18
- </style>
@@ -1 +0,0 @@
1
- .chargebacks[data-v-dc14aa5f]{border:1px solid #ddd;padding:10px;border-radius:5px}