@helpdice/sdk 0.0.6 → 0.0.8
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/account/index.d.ts +10 -1
- package/dist/account/index.js +7 -1
- package/dist/account/index.js.map +1 -1
- package/dist/account/types.d.ts +32 -0
- package/dist/account/types.js +2 -0
- package/dist/account/types.js.map +1 -0
- package/dist/account/update_profile.d.ts +12 -0
- package/dist/account/update_profile.js +13 -0
- package/dist/account/update_profile.js.map +1 -0
- package/dist/account/updateprofile.d.ts +12 -0
- package/dist/account/updateprofile.js +13 -0
- package/dist/account/updateprofile.js.map +1 -0
- package/dist/accounting/createInvoice.d.ts +12 -0
- package/dist/accounting/createInvoice.js +13 -0
- package/dist/accounting/createInvoice.js.map +1 -0
- package/dist/accounting/endpoint.d.ts +5 -0
- package/dist/accounting/endpoint.js +5 -1
- package/dist/accounting/endpoint.js.map +1 -1
- package/dist/accounting/index.d.ts +30 -0
- package/dist/accounting/index.js +9 -0
- package/dist/accounting/index.js.map +1 -1
- package/dist/accounting/invoice.d.ts +12 -0
- package/dist/accounting/invoice.js +13 -0
- package/dist/accounting/invoice.js.map +1 -0
- package/dist/accounting/submitInvoice.d.ts +12 -0
- package/dist/accounting/submitInvoice.js +13 -0
- package/dist/accounting/submitInvoice.js.map +1 -0
- package/dist/accounting/types.d.ts +40 -0
- package/dist/accounting/types.js +2 -0
- package/dist/accounting/types.js.map +1 -0
- package/dist/accounting/updateInvoice.d.ts +12 -0
- package/dist/accounting/updateInvoice.js +13 -0
- package/dist/accounting/updateInvoice.js.map +1 -0
- package/dist/assets/endpoint.js +2 -2
- package/dist/assets/endpoint.js.map +1 -1
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.js +32 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/signInWithGoogle.js +8 -3
- package/dist/auth/signInWithGoogle.js.map +1 -1
- package/dist/auth/types.d.ts +3 -0
- package/dist/config/axios.d.ts +1 -0
- package/dist/config/axios.js +24 -17
- package/dist/config/axios.js.map +1 -1
- package/dist/config/route.js +7 -1
- package/dist/config/route.js.map +1 -1
- package/dist/content/endpoint.d.ts +1 -0
- package/dist/content/endpoint.js +1 -0
- package/dist/content/endpoint.js.map +1 -1
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.js +1 -0
- package/dist/content/index.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory/endpoint.d.ts +7 -0
- package/dist/inventory/endpoint.js +8 -0
- package/dist/inventory/endpoint.js.map +1 -0
- package/dist/inventory/index.d.ts +6 -0
- package/dist/inventory/index.js +25 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/package.json +48 -0
- package/dist/payment/components/ProcessPayment.d.ts +1 -0
- package/dist/payment/components/ProcessPayment.js +267 -0
- package/dist/payment/components/ProcessPayment.js.map +1 -0
- package/dist/payment/index.d.ts +3 -8
- package/dist/payment/start.d.ts +7 -20
- package/dist/payment/start.js +41 -40
- package/dist/payment/start.js.map +1 -1
- package/dist/payment/types.d.ts +12 -0
- package/dist/payment/verify.d.ts +1 -1
- package/dist/sales/endpoint.d.ts +6 -0
- package/dist/sales/endpoint.js +7 -0
- package/dist/sales/endpoint.js.map +1 -0
- package/dist/sales/index.d.ts +4 -0
- package/dist/sales/index.js +11 -0
- package/dist/sales/index.js.map +1 -0
- package/dist/utils/auth.js +1 -0
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/exchangeRates.d.ts +1 -0
- package/dist/utils/exchangeRates.js +27 -0
- package/dist/utils/exchangeRates.js.map +1 -0
- package/dist/utils/handler.d.ts +11 -0
- package/dist/utils/handler.js +34 -0
- package/dist/utils/handler.js.map +1 -0
- package/dist/utils/share.d.ts +7 -0
- package/dist/utils/share.js +23 -0
- package/dist/utils/share.js.map +1 -0
- package/package.json +1 -2
package/dist/payment/start.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import { post } from "../config/axios.js";
|
|
2
|
-
import handler from "../config/handler.js";
|
|
3
2
|
import { getUrl } from "../config/route.js";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import handler from "../utils/handler.js";
|
|
4
|
+
// import type { Order } from "../order/types.js";
|
|
5
|
+
// import type { VerifyPayment } from "./types.js";
|
|
6
|
+
// import verify from "./verify.js";
|
|
7
|
+
function start(data, { config, onLoading, onSuccess, onError, onSettled } = {
|
|
8
|
+
config: null,
|
|
9
|
+
onLoading: (isLoading) => { },
|
|
10
|
+
onSuccess: (data) => { },
|
|
11
|
+
onError: (error) => { },
|
|
12
|
+
onSettled: () => { },
|
|
13
|
+
}) {
|
|
14
|
+
return handler({
|
|
15
|
+
promise: post(getUrl("payment", "v1", "create"), {
|
|
16
|
+
...data,
|
|
17
|
+
method: {
|
|
18
|
+
label: data.paymentService,
|
|
19
|
+
currency: data.currency,
|
|
20
|
+
},
|
|
21
|
+
}, config),
|
|
22
|
+
onLoading,
|
|
23
|
+
onError,
|
|
24
|
+
onSuccess: (data) => {
|
|
25
|
+
if (data?.method === "Razor Pay") {
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
const rzp1 = new window.Razorpay(data.options);
|
|
12
28
|
const options = data.options;
|
|
13
29
|
options.handler = async (response) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
id: data._id,
|
|
17
|
-
payment: response,
|
|
18
|
-
};
|
|
19
|
-
verify(body, {
|
|
20
|
-
onSuccess(data) {
|
|
21
|
-
onSuccess?.(data);
|
|
22
|
-
},
|
|
23
|
-
onError(error) {
|
|
24
|
-
onError?.(error);
|
|
25
|
-
},
|
|
26
|
-
});
|
|
30
|
+
console.log("Payment Success :", response);
|
|
31
|
+
onSuccess(response);
|
|
27
32
|
// const validateRes = await fetch('http://localhost:5000/order/validate', {
|
|
28
33
|
// method: 'POST',
|
|
29
34
|
// body: JSON.stringify(body),
|
|
@@ -34,26 +39,22 @@ const start = (data, { config, onFetching, onSuccess, onError, onSettled, }) =>
|
|
|
34
39
|
// const jsonRes = await validateRes.json();
|
|
35
40
|
// console.log(jsonRes);
|
|
36
41
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// // alert(response.error.metadata.order_id);
|
|
50
|
-
// // alert(response.error.metadata.payment_id);
|
|
51
|
-
// });
|
|
52
|
-
// rzp1.open();
|
|
42
|
+
rzp1.on("payment.failed", (response) => {
|
|
43
|
+
// console.log('Payment Failed :', response);
|
|
44
|
+
onError(response);
|
|
45
|
+
// alert(response.error.code);
|
|
46
|
+
// alert(response.error.description);
|
|
47
|
+
// alert(response.error.source);
|
|
48
|
+
// alert(response.error.step);
|
|
49
|
+
// alert(response.error.reason);
|
|
50
|
+
// alert(response.error.metadata.order_id);
|
|
51
|
+
// alert(response.error.metadata.payment_id);
|
|
52
|
+
});
|
|
53
|
+
rzp1.open();
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
|
-
onSettled
|
|
56
|
+
onSettled,
|
|
56
57
|
});
|
|
57
|
-
}
|
|
58
|
+
}
|
|
58
59
|
export default start;
|
|
59
60
|
//# sourceMappingURL=start.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/payment/start.
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/payment/start.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,kDAAkD;AAClD,mDAAmD;AACnD,oCAAoC;AAEpC,SAAS,KAAK,CACb,IAAI,EACJ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG;IACtD,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE,GAAE,CAAC;IAC5B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,GAAE,CAAC;IACvB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC;IACtB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB;IAED,OAAO,OAAO,CAAC;QACd,OAAO,EAAE,IAAI,CACZ,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,EACjC;YACC,GAAG,IAAI;YACP,MAAM,EAAE;gBACP,KAAK,EAAE,IAAI,CAAC,cAAc;gBAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACvB;SACD,EACD,MAAM,CACN;QACD,SAAS;QACT,OAAO;QACP,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YACnB,IAAI,IAAI,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,2BAA2B;gBAC3B,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,OAAO,CAAC,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE;oBACpC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;oBAC3C,SAAS,CAAC,QAAQ,CAAC,CAAC;oBACpB,4EAA4E;oBAC5E,sBAAsB;oBACtB,kCAAkC;oBAClC,iBAAiB;oBACjB,6CAA6C;oBAC7C,QAAQ;oBACR,MAAM;oBACN,4CAA4C;oBAC5C,wBAAwB;gBACzB,CAAC,CAAC;gBACF,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;oBACtC,6CAA6C;oBAC7C,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAClB,8BAA8B;oBAC9B,qCAAqC;oBACrC,gCAAgC;oBAChC,8BAA8B;oBAC9B,gCAAgC;oBAChC,2CAA2C;oBAC3C,6CAA6C;gBAC9C,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,CAAC;QACF,CAAC;QACD,SAAS;KACT,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC"}
|
package/dist/payment/types.d.ts
CHANGED
|
@@ -14,4 +14,16 @@ type VerifyPayment = {
|
|
|
14
14
|
id: string;
|
|
15
15
|
payment: unknown;
|
|
16
16
|
};
|
|
17
|
+
export interface SuccessProps {
|
|
18
|
+
data: unknown;
|
|
19
|
+
status: number;
|
|
20
|
+
statusText: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StartSuccessProp {
|
|
23
|
+
_id: string;
|
|
24
|
+
options: {
|
|
25
|
+
handler: (res: unknown) => void;
|
|
26
|
+
};
|
|
27
|
+
method: string;
|
|
28
|
+
}
|
|
17
29
|
export type { Payment, Method, VerifyPayment };
|
package/dist/payment/verify.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from "axios";
|
|
2
|
-
import type { SuccessProps } from "./
|
|
2
|
+
import type { SuccessProps } from "./types.js";
|
|
3
3
|
import type { VerifyPayment } from "./types.js";
|
|
4
4
|
declare const verify: (data: VerifyPayment, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
5
5
|
onFetching?: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/sales/endpoint.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG;IACb,EAAE,EAAE;QACH,aAAa,EAAE,eAAe;KAC9B;CACD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { get } from "../config/axios.js";
|
|
2
|
+
import { getUrl } from "../config/route.js";
|
|
3
|
+
const Sales = {
|
|
4
|
+
menuProducts: (slug) => get(getUrl("sales", "v1", "menu_products"), {
|
|
5
|
+
params: {
|
|
6
|
+
slug,
|
|
7
|
+
},
|
|
8
|
+
}),
|
|
9
|
+
};
|
|
10
|
+
export default Sales;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sales/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,KAAK,GAAG;IACb,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE,CAC9B,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,EAAE;QAC3C,MAAM,EAAE;YACP,IAAI;SACJ;KACD,CAAC;CACH,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/utils/auth.js
CHANGED
package/dist/utils/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,GAAG,MAAM,EAAsB,EAAE;IAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAoB,EAAE,EAAE;IAC1D,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,GAAG,MAAM,EAAsB,EAAE;IAC7D,iCAAiC;IACjC,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAoB,EAAE,EAAE;IAC1D,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// import { baseApiURL } from 'utils/config';
|
|
2
|
+
// import API from 'utils/axios';
|
|
3
|
+
export {};
|
|
4
|
+
// export const getExchangeRates = async (from?: string, to?: string) => {
|
|
5
|
+
// const config = {
|
|
6
|
+
// params: {
|
|
7
|
+
// from,
|
|
8
|
+
// to
|
|
9
|
+
// }
|
|
10
|
+
// };
|
|
11
|
+
// const { data } = await API.get(`${baseApiURL}/tools/exchange-rates`, config);
|
|
12
|
+
// return data.rates;
|
|
13
|
+
// };
|
|
14
|
+
// export async function convertCurrency(amount: number, fromCurrency?: string, toCurrency?: string) {
|
|
15
|
+
// try {
|
|
16
|
+
// const rates = await getExchangeRates(fromCurrency);
|
|
17
|
+
// if (!rates[toCurrency]) {
|
|
18
|
+
// throw new Error(`Currency ${toCurrency} is not available.`);
|
|
19
|
+
// }
|
|
20
|
+
// const convertedAmount = (amount * rates[toCurrency]).toFixed(2);
|
|
21
|
+
// return convertedAmount;
|
|
22
|
+
// } catch (error) {
|
|
23
|
+
// console.error('Error converting currency:', error);
|
|
24
|
+
// throw error;
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
27
|
+
//# sourceMappingURL=exchangeRates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchangeRates.js","sourceRoot":"","sources":["../../src/utils/exchangeRates.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iCAAiC;;AAEjC,0EAA0E;AAC1E,uBAAuB;AACvB,oBAAoB;AACpB,oBAAoB;AACpB,iBAAiB;AACjB,YAAY;AACZ,SAAS;AACT,oFAAoF;AACpF,yBAAyB;AACzB,KAAK;AAEL,sGAAsG;AACtG,YAAY;AACZ,8DAA8D;AAC9D,oCAAoC;AACpC,2EAA2E;AAC3E,YAAY;AACZ,2EAA2E;AAC3E,kCAAkC;AAClC,wBAAwB;AACxB,8DAA8D;AAC9D,uBAAuB;AACvB,QAAQ;AACR,IAAI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AxiosResponse } from "axios";
|
|
2
|
+
interface AxiosRequestHandlerOptions {
|
|
3
|
+
promise: Promise<AxiosResponse<any>>;
|
|
4
|
+
onLoading?: (isLoading: boolean) => void;
|
|
5
|
+
onSuccess?: (data: any) => void;
|
|
6
|
+
onError?: (error: any) => void;
|
|
7
|
+
onSettled?: () => void;
|
|
8
|
+
onProgress?: (progress: string) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const handler: ({ promise, onLoading, onSuccess, onError, onSettled, onProgress, }: AxiosRequestHandlerOptions) => void;
|
|
11
|
+
export default handler;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const handler = ({ promise, onLoading = () => { }, onSuccess = () => { }, onError = () => { }, onSettled = () => { }, onProgress = () => { }, }) => {
|
|
2
|
+
// Call onLoading at the start to show loading state
|
|
3
|
+
onLoading(true);
|
|
4
|
+
// Handling the passed promise
|
|
5
|
+
promise
|
|
6
|
+
.then((response) => {
|
|
7
|
+
// Show success state
|
|
8
|
+
console.log("Request Success:", response);
|
|
9
|
+
// Execute success callback if provided
|
|
10
|
+
if (onSuccess) {
|
|
11
|
+
onSuccess(response.data);
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
// Show error state
|
|
16
|
+
console.error("Request Error:", error);
|
|
17
|
+
// Execute error callback if provided
|
|
18
|
+
if (onError) {
|
|
19
|
+
onError(error);
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
.finally(() => {
|
|
23
|
+
// Execute settled callback (on success or error)
|
|
24
|
+
if (onSettled) {
|
|
25
|
+
onSettled();
|
|
26
|
+
}
|
|
27
|
+
// Call onLoading to hide loading indicator after completion
|
|
28
|
+
onLoading(false);
|
|
29
|
+
// Hide loading indicator
|
|
30
|
+
console.log("Request Completed");
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export default handler;
|
|
34
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/utils/handler.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,GAAG,CAAC,EAChB,OAAO,EACP,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EACpB,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EACpB,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,SAAS,GAAG,GAAG,EAAE,GAAE,CAAC,EACpB,UAAU,GAAG,GAAG,EAAE,GAAE,CAAC,GACO,EAAQ,EAAE;IACtC,oDAAoD;IACpD,SAAS,CAAC,IAAI,CAAC,CAAC;IAEhB,8BAA8B;IAC9B,OAAO;SACL,IAAI,CAAC,CAAC,QAAuB,EAAE,EAAE;QACjC,qBAAqB;QACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QAE1C,uCAAuC;QACvC,IAAI,SAAS,EAAE,CAAC;YACf,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACrB,mBAAmB;QACnB,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QAEvC,qCAAqC;QACrC,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;IACF,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACb,iDAAiD;QACjD,IAAI,SAAS,EAAE,CAAC;YACf,SAAS,EAAE,CAAC;QACb,CAAC;QAED,4DAA4D;QAC5D,SAAS,CAAC,KAAK,CAAC,CAAC;QAEjB,yBAAyB;QACzB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default function shareUrl(title, url) {
|
|
2
|
+
// URL encoding to ensure special characters are handled properly
|
|
3
|
+
const encodedTitle = encodeURIComponent(title);
|
|
4
|
+
const encodedUrl = encodeURIComponent(url);
|
|
5
|
+
const target = "_blank";
|
|
6
|
+
const dimension = "width=600,height=400";
|
|
7
|
+
// Social media share URLs
|
|
8
|
+
const shareLinks = {
|
|
9
|
+
facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}`,
|
|
10
|
+
twitter: `https://twitter.com/intent/tweet?text=${encodedTitle}&url=${encodedUrl}`,
|
|
11
|
+
linkedin: `https://www.linkedin.com/sharing/share-offsite/?url=${encodedUrl}`,
|
|
12
|
+
whatsapp: `https://api.whatsapp.com/send?text=${encodedTitle} ${encodedUrl}`,
|
|
13
|
+
pinterest: `https://www.pinterest.com/pin/create/button/?url=${encodedUrl}&description=${encodedTitle}`,
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
facebook: () => window.open(shareLinks.facebook, target, dimension),
|
|
17
|
+
twitter: () => window.open(shareLinks.twitter, target, dimension),
|
|
18
|
+
linkedin: () => window.open(shareLinks.linkedin, target, dimension),
|
|
19
|
+
whatsapp: () => window.open(shareLinks.whatsapp, target, dimension),
|
|
20
|
+
pinterest: () => window.open(shareLinks.pinterest, target, dimension),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=share.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/utils/share.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAa,EAAE,GAAW;IAC1D,iEAAiE;IACjE,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC;IACxB,MAAM,SAAS,GAAG,sBAAsB,CAAC;IACzC,0BAA0B;IAC1B,MAAM,UAAU,GAAG;QAClB,QAAQ,EAAE,gDAAgD,UAAU,EAAE;QACtE,OAAO,EAAE,yCAAyC,YAAY,QAAQ,UAAU,EAAE;QAClF,QAAQ,EAAE,uDAAuD,UAAU,EAAE;QAC7E,QAAQ,EAAE,sCAAsC,YAAY,IAAI,UAAU,EAAE;QAC5E,SAAS,EAAE,oDAAoD,UAAU,gBAAgB,YAAY,EAAE;KACvG,CAAC;IAEF,OAAO;QACN,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;QACnE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;QACjE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;QACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;QACnE,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC;KACrE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@helpdice/sdk",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "A backend API-based SDK (Software Development Kit) provides developers with pre-built tools and libraries to interact seamlessly with a backend server or service. It simplifies the process of integrating external functionality, such as authentication, data storage, or third-party services, into applications. The SDK typically includes API endpoints, functions, and documentation, allowing developers to make requests, handle responses, and manage errors efficiently. By abstracting complex backend logic, it speeds up development, reduces coding errors, and ensures consistent interactions with the backend, making it easier to build scalable, secure, and feature-rich applications.",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.8",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"repository": {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"swr": "^2.3.0",
|
|
41
41
|
"zod": "^3.24.1"
|
|
42
42
|
},
|
|
43
|
-
"packageManager": "pnpm@9.6.0+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e",
|
|
44
43
|
"scripts": {
|
|
45
44
|
"build": "tsc",
|
|
46
45
|
"check": "biome check --write ./src",
|