@bigbinary/neeto-payments-frontend 3.3.37 → 3.3.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/dist/CashPaymentButton.js +3 -1
- package/dist/CashPaymentButton.js.map +1 -1
- package/dist/RazorpayPaymentButton.js +2 -0
- package/dist/RazorpayPaymentButton.js.map +1 -1
- package/dist/UpiPayment.js +3 -1
- package/dist/UpiPayment.js.map +1 -1
- package/dist/cjs/CashPaymentButton.js +3 -1
- package/dist/cjs/CashPaymentButton.js.map +1 -1
- package/dist/cjs/RazorpayPaymentButton.js +2 -0
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
- package/dist/cjs/UpiPayment.js +3 -1
- package/dist/cjs/UpiPayment.js.map +1 -1
- package/package.json +14 -14
|
@@ -17,6 +17,7 @@ var CashPaymentButton = function CashPaymentButton(_ref) {
|
|
|
17
17
|
payableId = _ref.payableId,
|
|
18
18
|
payableType = _ref.payableType,
|
|
19
19
|
discountCode = _ref.discountCode,
|
|
20
|
+
customAmount = _ref.customAmount,
|
|
20
21
|
_ref$isDisabled = _ref.isDisabled,
|
|
21
22
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
22
23
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -40,7 +41,8 @@ var CashPaymentButton = function CashPaymentButton(_ref) {
|
|
|
40
41
|
createCashPayment({
|
|
41
42
|
payableId: payableId,
|
|
42
43
|
payableType: payableType,
|
|
43
|
-
discountCode: discountCode
|
|
44
|
+
discountCode: discountCode,
|
|
45
|
+
customAmount: customAmount
|
|
44
46
|
});
|
|
45
47
|
};
|
|
46
48
|
return /*#__PURE__*/jsx(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashPaymentButton.js","sources":["../app/javascript/src/components/CashPaymentButton.jsx"],"sourcesContent":["import { noop } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst CashPaymentButton = ({\n label,\n payableId,\n payableType,\n discountCode,\n isDisabled = false,\n isLoading = false,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const { isPending, mutate: createCashPayment } = useCreateCashPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = () => {\n onBeforePayment();\n createCashPayment({ payableId, payableType, discountCode });\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.proceed\")}\n loading={isPending || isLoading}\n onClick={handleSubmit}\n />\n );\n};\n\nexport default CashPaymentButton;\n"],"names":["CashPaymentButton","_ref","label","payableId","payableType","discountCode","_ref$isDisabled","isDisabled","_ref$isLoading","isLoading","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","t","_useCreateCashPayment","useCreateCashPayment","onSuccess","onError","isPending","createCashPayment","mutate","handleSubmit","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"CashPaymentButton.js","sources":["../app/javascript/src/components/CashPaymentButton.jsx"],"sourcesContent":["import { noop } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst CashPaymentButton = ({\n label,\n payableId,\n payableType,\n discountCode,\n customAmount,\n isDisabled = false,\n isLoading = false,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const { isPending, mutate: createCashPayment } = useCreateCashPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = () => {\n onBeforePayment();\n createCashPayment({ payableId, payableType, discountCode, customAmount });\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.proceed\")}\n loading={isPending || isLoading}\n onClick={handleSubmit}\n />\n );\n};\n\nexport default CashPaymentButton;\n"],"names":["CashPaymentButton","_ref","label","payableId","payableType","discountCode","customAmount","_ref$isDisabled","isDisabled","_ref$isLoading","isLoading","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","t","_useCreateCashPayment","useCreateCashPayment","onSuccess","onError","isPending","createCashPayment","mutate","handleSubmit","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAWjB;AAAA,EAAA,IAVJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IAAAC,eAAA,GAAAN,IAAA,CACZO,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;IAAAE,cAAA,GAAAR,IAAA,CAClBS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;IAAAE,oBAAA,GAAAV,IAAA,CACjBW,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAGE,KAAAA,CAAAA,GAAAA,IAAI,GAAAF,oBAAA;IAAAG,oBAAA,GAAAb,IAAA,CACtBc,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAGD,KAAAA,CAAAA,GAAAA,IAAI,GAAAC,oBAAA;IAAAE,qBAAA,GAAAf,IAAA,CACtBgB,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAGH,KAAAA,CAAAA,GAAAA,IAAI,GAAAG,qBAAA;AAE1B,EAAA,IAAAE,eAAA,GAAcC,cAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;EAET,IAAAC,qBAAA,GAAiDC,oBAAoB,CAAC;AACpEC,MAAAA,SAAS,EAAEN,mBAAmB;AAC9BO,MAAAA,OAAO,EAAET;AACX,KAAC,CAAC;IAHMU,SAAS,GAAAJ,qBAAA,CAATI,SAAS;IAAUC,iBAAiB,GAAAL,qBAAA,CAAzBM,MAAM;AAKzB,EAAA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,GAAS;AACzBhB,IAAAA,eAAe,EAAE;AACjBc,IAAAA,iBAAiB,CAAC;AAAEvB,MAAAA,SAAS,EAATA,SAAS;AAAEC,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,YAAY,EAAZA,YAAY;AAAEC,MAAAA,YAAY,EAAZA;AAAa,KAAC,CAAC;GAC1E;EAED,oBACEuB,GAAA,CAACC,MAAM,EAAA;IACLC,QAAQ,EAAEN,SAAS,IAAIjB,UAAW;AAClCN,IAAAA,KAAK,EAAEA,KAAK,IAAIkB,CAAC,CAAC,8BAA8B,CAAE;IAClDY,OAAO,EAAEP,SAAS,IAAIf,SAAU;AAChCuB,IAAAA,OAAO,EAAEL;AAAa,GACvB,CAAC;AAEN;;;;"}
|
|
@@ -32,6 +32,7 @@ var RazorpayPaymentButton = function RazorpayPaymentButton(_ref) {
|
|
|
32
32
|
payableId = _ref.payableId,
|
|
33
33
|
discountCode = _ref.discountCode,
|
|
34
34
|
email = _ref.email,
|
|
35
|
+
customAmount = _ref.customAmount,
|
|
35
36
|
isDisabled = _ref.isDisabled,
|
|
36
37
|
isLoading = _ref.isLoading,
|
|
37
38
|
name = _ref.name,
|
|
@@ -126,6 +127,7 @@ var RazorpayPaymentButton = function RazorpayPaymentButton(_ref) {
|
|
|
126
127
|
payableId: payableId,
|
|
127
128
|
payableType: payableType,
|
|
128
129
|
discountCode: discountCode,
|
|
130
|
+
customAmount: customAmount,
|
|
129
131
|
customerAttributes: {
|
|
130
132
|
email: email,
|
|
131
133
|
name: name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RazorpayPaymentButton.js","sources":["../app/javascript/src/components/RazorpayPaymentButton.jsx"],"sourcesContent":["import { isNotPresent, noop, findBy } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateRazorpayPayment } from \"hooks/reactQuery/razorpay/usePaymentApi\";\nimport { RAZORPAY_PAYMENT_BUTTON_OPTIONS } from \"src/constants\";\n\nconst loadScript = src =>\n new Promise(resolve => {\n const script = document.createElement(\"script\");\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n\n script.onerror = () => {\n resolve(false);\n };\n document.body.appendChild(script);\n });\n\nconst RazorpayPaymentButton = ({\n label,\n payableId,\n discountCode,\n email,\n isDisabled,\n isLoading,\n name,\n isCardPreservable = false,\n theme = {},\n payableType = null,\n onBeforePayment = noop,\n onSuccessfulPayment = noop,\n onFailedPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const openRazorpayCheckout = async options => {\n const script = await loadScript(\n \"https://checkout.razorpay.com/v1/checkout.js\"\n );\n\n if (!script) {\n logger.error(t(\"neetoPayments.razorpay.loadError\"));\n\n return;\n }\n const checkout = new window.Razorpay(options);\n checkout.open();\n };\n\n const handlePayment = response => {\n if (isNotPresent(response?.razorpay_signature)) {\n onFailedPayment();\n\n return;\n }\n\n onSuccessfulPayment();\n };\n\n const handleSuccess = ({ payment }) => {\n if (payment?.status === \"successful\") {\n return onSuccessfulPayment();\n }\n\n const save = isCardPreservable ? 1 : 0;\n const themePrimaryColor = findBy(\n { key: \"primary_color\" },\n theme?.properties\n )?.value;\n\n const options = {\n save,\n key: payment.publicKey,\n order_id: payment.orderIdentifier,\n customer_id: payment.customerIdentifier,\n prefill: { name, email },\n modal: { confirm_close: true, ondismiss: onFailedPayment },\n handler: handlePayment,\n theme: { color: themePrimaryColor ?? \"#0da84c\" },\n };\n\n return openRazorpayCheckout(\n mergeDeepLeft(RAZORPAY_PAYMENT_BUTTON_OPTIONS, options)\n );\n };\n\n const { isPending, mutate: createRazorpayOrder } = useCreateRazorpayPayment({\n onSuccess: handleSuccess,\n });\n\n const handleClick = () => {\n onBeforePayment();\n const payload = {\n payableId,\n payableType,\n discountCode,\n customerAttributes: { email, name },\n };\n createRazorpayOrder(payload);\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.pay\")}\n loading={isPending || isLoading}\n onClick={handleClick}\n />\n );\n};\n\nexport default RazorpayPaymentButton;\n"],"names":["loadScript","src","Promise","resolve","script","document","createElement","onload","onerror","body","appendChild","RazorpayPaymentButton","_ref","label","payableId","discountCode","email","isDisabled","isLoading","name","_ref$isCardPreservabl","isCardPreservable","_ref$theme","theme","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onSuccessfulPaym","onSuccessfulPayment","_ref$onFailedPayment","onFailedPayment","_useTranslation","useTranslation","t","openRazorpayCheckout","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","checkout","wrap","_callee$","_context","prev","next","sent","logger","error","abrupt","window","Razorpay","open","stop","_x","apply","arguments","handlePayment","response","isNotPresent","razorpay_signature","handleSuccess","_ref3","_findBy","payment","status","save","themePrimaryColor","findBy","key","properties","value","publicKey","order_id","orderIdentifier","customer_id","customerIdentifier","prefill","modal","confirm_close","ondismiss","handler","color","mergeDeepLeft","RAZORPAY_PAYMENT_BUTTON_OPTIONS","_useCreateRazorpayPay","useCreateRazorpayPayment","onSuccess","isPending","createRazorpayOrder","mutate","handleClick","payload","customerAttributes","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAA;AAAA,EAAA,OACpB,IAAIC,OAAO,CAAC,UAAAC,OAAO,EAAI;AACrB,IAAA,IAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;IAC/CF,MAAM,CAACH,GAAG,GAAGA,GAAG;IAChBG,MAAM,CAACG,MAAM,GAAG,YAAM;MACpBJ,OAAO,CAAC,IAAI,CAAC;KACd;IAEDC,MAAM,CAACI,OAAO,GAAG,YAAM;MACrBL,OAAO,CAAC,KAAK,CAAC;KACf;AACDE,IAAAA,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACN,MAAM,CAAC;AACnC,GAAC,CAAC;AAAA,CAAA;AAEJ,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"RazorpayPaymentButton.js","sources":["../app/javascript/src/components/RazorpayPaymentButton.jsx"],"sourcesContent":["import { isNotPresent, noop, findBy } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateRazorpayPayment } from \"hooks/reactQuery/razorpay/usePaymentApi\";\nimport { RAZORPAY_PAYMENT_BUTTON_OPTIONS } from \"src/constants\";\n\nconst loadScript = src =>\n new Promise(resolve => {\n const script = document.createElement(\"script\");\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n\n script.onerror = () => {\n resolve(false);\n };\n document.body.appendChild(script);\n });\n\nconst RazorpayPaymentButton = ({\n label,\n payableId,\n discountCode,\n email,\n customAmount,\n isDisabled,\n isLoading,\n name,\n isCardPreservable = false,\n theme = {},\n payableType = null,\n onBeforePayment = noop,\n onSuccessfulPayment = noop,\n onFailedPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const openRazorpayCheckout = async options => {\n const script = await loadScript(\n \"https://checkout.razorpay.com/v1/checkout.js\"\n );\n\n if (!script) {\n logger.error(t(\"neetoPayments.razorpay.loadError\"));\n\n return;\n }\n const checkout = new window.Razorpay(options);\n checkout.open();\n };\n\n const handlePayment = response => {\n if (isNotPresent(response?.razorpay_signature)) {\n onFailedPayment();\n\n return;\n }\n\n onSuccessfulPayment();\n };\n\n const handleSuccess = ({ payment }) => {\n if (payment?.status === \"successful\") {\n return onSuccessfulPayment();\n }\n\n const save = isCardPreservable ? 1 : 0;\n const themePrimaryColor = findBy(\n { key: \"primary_color\" },\n theme?.properties\n )?.value;\n\n const options = {\n save,\n key: payment.publicKey,\n order_id: payment.orderIdentifier,\n customer_id: payment.customerIdentifier,\n prefill: { name, email },\n modal: { confirm_close: true, ondismiss: onFailedPayment },\n handler: handlePayment,\n theme: { color: themePrimaryColor ?? \"#0da84c\" },\n };\n\n return openRazorpayCheckout(\n mergeDeepLeft(RAZORPAY_PAYMENT_BUTTON_OPTIONS, options)\n );\n };\n\n const { isPending, mutate: createRazorpayOrder } = useCreateRazorpayPayment({\n onSuccess: handleSuccess,\n });\n\n const handleClick = () => {\n onBeforePayment();\n const payload = {\n payableId,\n payableType,\n discountCode,\n customAmount,\n customerAttributes: { email, name },\n };\n createRazorpayOrder(payload);\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.pay\")}\n loading={isPending || isLoading}\n onClick={handleClick}\n />\n );\n};\n\nexport default RazorpayPaymentButton;\n"],"names":["loadScript","src","Promise","resolve","script","document","createElement","onload","onerror","body","appendChild","RazorpayPaymentButton","_ref","label","payableId","discountCode","email","customAmount","isDisabled","isLoading","name","_ref$isCardPreservabl","isCardPreservable","_ref$theme","theme","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onSuccessfulPaym","onSuccessfulPayment","_ref$onFailedPayment","onFailedPayment","_useTranslation","useTranslation","t","openRazorpayCheckout","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","checkout","wrap","_callee$","_context","prev","next","sent","logger","error","abrupt","window","Razorpay","open","stop","_x","apply","arguments","handlePayment","response","isNotPresent","razorpay_signature","handleSuccess","_ref3","_findBy","payment","status","save","themePrimaryColor","findBy","key","properties","value","publicKey","order_id","orderIdentifier","customer_id","customerIdentifier","prefill","modal","confirm_close","ondismiss","handler","color","mergeDeepLeft","RAZORPAY_PAYMENT_BUTTON_OPTIONS","_useCreateRazorpayPay","useCreateRazorpayPayment","onSuccess","isPending","createRazorpayOrder","mutate","handleClick","payload","customerAttributes","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAA;AAAA,EAAA,OACpB,IAAIC,OAAO,CAAC,UAAAC,OAAO,EAAI;AACrB,IAAA,IAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;IAC/CF,MAAM,CAACH,GAAG,GAAGA,GAAG;IAChBG,MAAM,CAACG,MAAM,GAAG,YAAM;MACpBJ,OAAO,CAAC,IAAI,CAAC;KACd;IAEDC,MAAM,CAACI,OAAO,GAAG,YAAM;MACrBL,OAAO,CAAC,KAAK,CAAC;KACf;AACDE,IAAAA,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACN,MAAM,CAAC;AACnC,GAAC,CAAC;AAAA,CAAA;AAEJ,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAerB;AAAA,EAAA,IAdJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,UAAU,GAAAN,IAAA,CAAVM,UAAU;IACVC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IAAAC,qBAAA,GAAAT,IA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A,IAAMC,WAAW,GAAG,SAAdA,WAAWA,GAAS;AACxBnE,IAAAA,eAAe,EAAE;AACjB,IAAA,IAAMoE,OAAO,GAAG;AACdlF,MAAAA,SAAS,EAATA,SAAS;AACTY,MAAAA,WAAW,EAAXA,WAAW;AACXX,MAAAA,YAAY,EAAZA,YAAY;AACZE,MAAAA,YAAY,EAAZA,YAAY;AACZgF,MAAAA,kBAAkB,EAAE;AAAEjF,QAAAA,KAAK,EAALA,KAAK;AAAEI,QAAAA,IAAI,EAAJA;AAAK;KACnC;IACDyE,mBAAmB,CAACG,OAAO,CAAC;GAC7B;EAED,oBACEE,GAAA,CAACC,MAAM,EAAA;IACLC,QAAQ,EAAER,SAAS,IAAI1E,UAAW;AAClCL,IAAAA,KAAK,EAAEA,KAAK,IAAIuB,CAAC,CAAC,0BAA0B,CAAE;IAC9CiE,OAAO,EAAET,SAAS,IAAIzE,SAAU;AAChCmF,IAAAA,OAAO,EAAEP;AAAY,GACtB,CAAC;AAEN;;;;"}
|
package/dist/UpiPayment.js
CHANGED
|
@@ -31,6 +31,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
31
31
|
var fee = _ref.fee,
|
|
32
32
|
payableId = _ref.payableId,
|
|
33
33
|
discountCode = _ref.discountCode,
|
|
34
|
+
customAmount = _ref.customAmount,
|
|
34
35
|
handleCancel = _ref.handleCancel,
|
|
35
36
|
_ref$payableType = _ref.payableType,
|
|
36
37
|
payableType = _ref$payableType === void 0 ? null : _ref$payableType,
|
|
@@ -53,6 +54,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
53
54
|
onBeforePayment();
|
|
54
55
|
var payload = _objectSpread(_objectSpread({}, values), {}, {
|
|
55
56
|
payableId: payableId,
|
|
57
|
+
customAmount: customAmount,
|
|
56
58
|
payableType: payableType,
|
|
57
59
|
discountCode: discountCode
|
|
58
60
|
});
|
|
@@ -88,7 +90,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
88
90
|
},
|
|
89
91
|
value: vpaIdToQrCodeValue(vpaId)
|
|
90
92
|
}), /*#__PURE__*/jsx(Typography, {
|
|
91
|
-
className: "mt-2
|
|
93
|
+
className: "w-full mt-2 text-center break-words",
|
|
92
94
|
style: "body2",
|
|
93
95
|
children: vpaId
|
|
94
96
|
})]
|
package/dist/UpiPayment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpiPayment.js","sources":["../app/javascript/src/components/UpiPayment/constants.js","../app/javascript/src/components/UpiPayment/utils.js","../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, payableType, discountCode };\n createPayment(payload);\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"mt-2
|
|
1
|
+
{"version":3,"file":"UpiPayment.js","sources":["../app/javascript/src/components/UpiPayment/constants.js","../app/javascript/src/components/UpiPayment/utils.js","../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, customAmount, payableType, discountCode };\n createPayment(payload);\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"w-full mt-2 text-center break-words\"\n style=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n required\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\"neetoPayments.upi.payment.transaction.placeholder\")}\n />\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: !dirty || isPending,\n loading: isPending,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default UpiPayment;\n"],"names":["VALIDATION_SCHEMA","yup","object","identifier","string","required","t","min","max","vpaIdToQrCodeValue","vpaId","concat","UpiPayment","_ref","fee","payableId","discountCode","customAmount","handleCancel","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","vpaIds","pluck","vpas","_useCreateUpiPayment","useCreateUpiPayment","onSuccess","onError","isPending","createPayment","mutate","handleSubmit","values","payload","_objectSpread","_jsx","Form","className","formikProps","onSubmit","initialValues","validationSchema","children","_ref2","dirty","_jsxs","_Fragment","Typography","style","count","length","isPresent","map","QRCodeImage","size","width","height","value","Input","label","name","placeholder","ActionBlock","cancelButtonProps","onClick","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;AAGO,IAAMA,iBAAiB,GAAGC,GAAG,CAACC,MAAM,CAAC;AAC1CC,EAAAA,UAAU,EAAEF,GAAG,CACZG,MAAM,EAAE,CACRC,QAAQ,CAACC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAC7DC,GAAG,CAAC,CAAC,EAAED,CAAC,CAAC,qDAAqD,CAAC,CAAC,CAChEE,GAAG,CAAC,CAAC,EAAEF,CAAC,CAAC,qDAAqD,CAAC;AACpE,CAAC,CAAC;;ACTK,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGC,KAAK,EAAA;EAAA,OAAAC,eAAAA,CAAAA,MAAA,CAAoBD,KAAK,CAAA;AAAA,CAAE;;;;ACYlE,IAAME,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAUV;AAAA,EAAA,IATJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IACHC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IAAAC,gBAAA,GAAAN,IAAA,CACZO,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;IAAAE,oBAAA,GAAAR,IAAA,CAClBS,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAGE,KAAAA,CAAAA,GAAAA,IAAI,GAAA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;AACxD+D,UAAAA,IAAI,EAAC,YAAY;UACjBC,WAAW,EAAEhE,CAAC,CAAC,mDAAmD;AAAE,SACrE,CAAC,eACFsC,GAAA,CAAC2B,WAAW,EAAA;AACVC,UAAAA,iBAAiB,EAAE;AACjBJ,YAAAA,KAAK,EAAE9D,CAAC,CAAC,wCAAwC,CAAC;AAClDmE,YAAAA,OAAO,EAAEvD,YAAY;AACrBwD,YAAAA,QAAQ,EAAErC;WACV;AACFsC,UAAAA,iBAAiB,EAAE;AACjBP,YAAAA,KAAK,EAAE9D,CAAC,CAAC,0CAA0C,CAAC;AACpDoE,YAAAA,QAAQ,EAAE,CAACrB,KAAK,IAAIhB,SAAS;AAC7BuC,YAAAA,OAAO,EAAEvC;AACX;AAAE,SACH,CAAC;AAAA,OACF,CAAC;AAAA;AACJ,GACG,CAAC;AAEX;;;;"}
|
|
@@ -19,6 +19,7 @@ var CashPaymentButton = function CashPaymentButton(_ref) {
|
|
|
19
19
|
payableId = _ref.payableId,
|
|
20
20
|
payableType = _ref.payableType,
|
|
21
21
|
discountCode = _ref.discountCode,
|
|
22
|
+
customAmount = _ref.customAmount,
|
|
22
23
|
_ref$isDisabled = _ref.isDisabled,
|
|
23
24
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
24
25
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -42,7 +43,8 @@ var CashPaymentButton = function CashPaymentButton(_ref) {
|
|
|
42
43
|
createCashPayment({
|
|
43
44
|
payableId: payableId,
|
|
44
45
|
payableType: payableType,
|
|
45
|
-
discountCode: discountCode
|
|
46
|
+
discountCode: discountCode,
|
|
47
|
+
customAmount: customAmount
|
|
46
48
|
});
|
|
47
49
|
};
|
|
48
50
|
return /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashPaymentButton.js","sources":["../../app/javascript/src/components/CashPaymentButton.jsx"],"sourcesContent":["import { noop } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst CashPaymentButton = ({\n label,\n payableId,\n payableType,\n discountCode,\n isDisabled = false,\n isLoading = false,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const { isPending, mutate: createCashPayment } = useCreateCashPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = () => {\n onBeforePayment();\n createCashPayment({ payableId, payableType, discountCode });\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.proceed\")}\n loading={isPending || isLoading}\n onClick={handleSubmit}\n />\n );\n};\n\nexport default CashPaymentButton;\n"],"names":["CashPaymentButton","_ref","label","payableId","payableType","discountCode","_ref$isDisabled","isDisabled","_ref$isLoading","isLoading","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","t","_useCreateCashPayment","useCreateCashPayment","onSuccess","onError","isPending","createCashPayment","mutate","handleSubmit","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"CashPaymentButton.js","sources":["../../app/javascript/src/components/CashPaymentButton.jsx"],"sourcesContent":["import { noop } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst CashPaymentButton = ({\n label,\n payableId,\n payableType,\n discountCode,\n customAmount,\n isDisabled = false,\n isLoading = false,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const { isPending, mutate: createCashPayment } = useCreateCashPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = () => {\n onBeforePayment();\n createCashPayment({ payableId, payableType, discountCode, customAmount });\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.proceed\")}\n loading={isPending || isLoading}\n onClick={handleSubmit}\n />\n );\n};\n\nexport default CashPaymentButton;\n"],"names":["CashPaymentButton","_ref","label","payableId","payableType","discountCode","customAmount","_ref$isDisabled","isDisabled","_ref$isLoading","isLoading","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","t","_useCreateCashPayment","useCreateCashPayment","onSuccess","onError","isPending","createCashPayment","mutate","handleSubmit","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAWjB;AAAA,EAAA,IAVJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IAAAC,eAAA,GAAAN,IAAA,CACZO,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;IAAAE,cAAA,GAAAR,IAAA,CAClBS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;IAAAE,oBAAA,GAAAV,IAAA,CACjBW,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAGE,KAAAA,CAAAA,GAAAA,cAAI,GAAAF,oBAAA;IAAAG,oBAAA,GAAAb,IAAA,CACtBc,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAGD,KAAAA,CAAAA,GAAAA,cAAI,GAAAC,oBAAA;IAAAE,qBAAA,GAAAf,IAAA,CACtBgB,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAGH,KAAAA,CAAAA,GAAAA,cAAI,GAAAG,qBAAA;AAE1B,EAAA,IAAAE,eAAA,GAAcC,2BAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;EAET,IAAAC,qBAAA,GAAiDC,kCAAoB,CAAC;AACpEC,MAAAA,SAAS,EAAEN,mBAAmB;AAC9BO,MAAAA,OAAO,EAAET;AACX,KAAC,CAAC;IAHMU,SAAS,GAAAJ,qBAAA,CAATI,SAAS;IAAUC,iBAAiB,GAAAL,qBAAA,CAAzBM,MAAM;AAKzB,EAAA,IAAMC,YAAY,GAAG,SAAfA,YAAYA,GAAS;AACzBhB,IAAAA,eAAe,EAAE;AACjBc,IAAAA,iBAAiB,CAAC;AAAEvB,MAAAA,SAAS,EAATA,SAAS;AAAEC,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,YAAY,EAAZA,YAAY;AAAEC,MAAAA,YAAY,EAAZA;AAAa,KAAC,CAAC;GAC1E;EAED,oBACEuB,cAAA,CAACC,MAAM,EAAA;IACLC,QAAQ,EAAEN,SAAS,IAAIjB,UAAW;AAClCN,IAAAA,KAAK,EAAEA,KAAK,IAAIkB,CAAC,CAAC,8BAA8B,CAAE;IAClDY,OAAO,EAAEP,SAAS,IAAIf,SAAU;AAChCuB,IAAAA,OAAO,EAAEL;AAAa,GACvB,CAAC;AAEN;;;;"}
|
|
@@ -34,6 +34,7 @@ var RazorpayPaymentButton = function RazorpayPaymentButton(_ref) {
|
|
|
34
34
|
payableId = _ref.payableId,
|
|
35
35
|
discountCode = _ref.discountCode,
|
|
36
36
|
email = _ref.email,
|
|
37
|
+
customAmount = _ref.customAmount,
|
|
37
38
|
isDisabled = _ref.isDisabled,
|
|
38
39
|
isLoading = _ref.isLoading,
|
|
39
40
|
name = _ref.name,
|
|
@@ -128,6 +129,7 @@ var RazorpayPaymentButton = function RazorpayPaymentButton(_ref) {
|
|
|
128
129
|
payableId: payableId,
|
|
129
130
|
payableType: payableType,
|
|
130
131
|
discountCode: discountCode,
|
|
132
|
+
customAmount: customAmount,
|
|
131
133
|
customerAttributes: {
|
|
132
134
|
email: email,
|
|
133
135
|
name: name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RazorpayPaymentButton.js","sources":["../../app/javascript/src/components/RazorpayPaymentButton.jsx"],"sourcesContent":["import { isNotPresent, noop, findBy } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateRazorpayPayment } from \"hooks/reactQuery/razorpay/usePaymentApi\";\nimport { RAZORPAY_PAYMENT_BUTTON_OPTIONS } from \"src/constants\";\n\nconst loadScript = src =>\n new Promise(resolve => {\n const script = document.createElement(\"script\");\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n\n script.onerror = () => {\n resolve(false);\n };\n document.body.appendChild(script);\n });\n\nconst RazorpayPaymentButton = ({\n label,\n payableId,\n discountCode,\n email,\n isDisabled,\n isLoading,\n name,\n isCardPreservable = false,\n theme = {},\n payableType = null,\n onBeforePayment = noop,\n onSuccessfulPayment = noop,\n onFailedPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const openRazorpayCheckout = async options => {\n const script = await loadScript(\n \"https://checkout.razorpay.com/v1/checkout.js\"\n );\n\n if (!script) {\n logger.error(t(\"neetoPayments.razorpay.loadError\"));\n\n return;\n }\n const checkout = new window.Razorpay(options);\n checkout.open();\n };\n\n const handlePayment = response => {\n if (isNotPresent(response?.razorpay_signature)) {\n onFailedPayment();\n\n return;\n }\n\n onSuccessfulPayment();\n };\n\n const handleSuccess = ({ payment }) => {\n if (payment?.status === \"successful\") {\n return onSuccessfulPayment();\n }\n\n const save = isCardPreservable ? 1 : 0;\n const themePrimaryColor = findBy(\n { key: \"primary_color\" },\n theme?.properties\n )?.value;\n\n const options = {\n save,\n key: payment.publicKey,\n order_id: payment.orderIdentifier,\n customer_id: payment.customerIdentifier,\n prefill: { name, email },\n modal: { confirm_close: true, ondismiss: onFailedPayment },\n handler: handlePayment,\n theme: { color: themePrimaryColor ?? \"#0da84c\" },\n };\n\n return openRazorpayCheckout(\n mergeDeepLeft(RAZORPAY_PAYMENT_BUTTON_OPTIONS, options)\n );\n };\n\n const { isPending, mutate: createRazorpayOrder } = useCreateRazorpayPayment({\n onSuccess: handleSuccess,\n });\n\n const handleClick = () => {\n onBeforePayment();\n const payload = {\n payableId,\n payableType,\n discountCode,\n customerAttributes: { email, name },\n };\n createRazorpayOrder(payload);\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.pay\")}\n loading={isPending || isLoading}\n onClick={handleClick}\n />\n );\n};\n\nexport default RazorpayPaymentButton;\n"],"names":["loadScript","src","Promise","resolve","script","document","createElement","onload","onerror","body","appendChild","RazorpayPaymentButton","_ref","label","payableId","discountCode","email","isDisabled","isLoading","name","_ref$isCardPreservabl","isCardPreservable","_ref$theme","theme","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onSuccessfulPaym","onSuccessfulPayment","_ref$onFailedPayment","onFailedPayment","_useTranslation","useTranslation","t","openRazorpayCheckout","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","checkout","wrap","_callee$","_context","prev","next","sent","logger","error","abrupt","window","Razorpay","open","stop","_x","apply","arguments","handlePayment","response","isNotPresent","razorpay_signature","handleSuccess","_ref3","_findBy","payment","status","save","themePrimaryColor","findBy","key","properties","value","publicKey","order_id","orderIdentifier","customer_id","customerIdentifier","prefill","modal","confirm_close","ondismiss","handler","color","mergeDeepLeft","RAZORPAY_PAYMENT_BUTTON_OPTIONS","_useCreateRazorpayPay","useCreateRazorpayPayment","onSuccess","isPending","createRazorpayOrder","mutate","handleClick","payload","customerAttributes","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAA;AAAA,EAAA,OACpB,IAAIC,OAAO,CAAC,UAAAC,OAAO,EAAI;AACrB,IAAA,IAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;IAC/CF,MAAM,CAACH,GAAG,GAAGA,GAAG;IAChBG,MAAM,CAACG,MAAM,GAAG,YAAM;MACpBJ,OAAO,CAAC,IAAI,CAAC;KACd;IAEDC,MAAM,CAACI,OAAO,GAAG,YAAM;MACrBL,OAAO,CAAC,KAAK,CAAC;KACf;AACDE,IAAAA,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACN,MAAM,CAAC;AACnC,GAAC,CAAC;AAAA,CAAA;AAEJ,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"RazorpayPaymentButton.js","sources":["../../app/javascript/src/components/RazorpayPaymentButton.jsx"],"sourcesContent":["import { isNotPresent, noop, findBy } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateRazorpayPayment } from \"hooks/reactQuery/razorpay/usePaymentApi\";\nimport { RAZORPAY_PAYMENT_BUTTON_OPTIONS } from \"src/constants\";\n\nconst loadScript = src =>\n new Promise(resolve => {\n const script = document.createElement(\"script\");\n script.src = src;\n script.onload = () => {\n resolve(true);\n };\n\n script.onerror = () => {\n resolve(false);\n };\n document.body.appendChild(script);\n });\n\nconst RazorpayPaymentButton = ({\n label,\n payableId,\n discountCode,\n email,\n customAmount,\n isDisabled,\n isLoading,\n name,\n isCardPreservable = false,\n theme = {},\n payableType = null,\n onBeforePayment = noop,\n onSuccessfulPayment = noop,\n onFailedPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const openRazorpayCheckout = async options => {\n const script = await loadScript(\n \"https://checkout.razorpay.com/v1/checkout.js\"\n );\n\n if (!script) {\n logger.error(t(\"neetoPayments.razorpay.loadError\"));\n\n return;\n }\n const checkout = new window.Razorpay(options);\n checkout.open();\n };\n\n const handlePayment = response => {\n if (isNotPresent(response?.razorpay_signature)) {\n onFailedPayment();\n\n return;\n }\n\n onSuccessfulPayment();\n };\n\n const handleSuccess = ({ payment }) => {\n if (payment?.status === \"successful\") {\n return onSuccessfulPayment();\n }\n\n const save = isCardPreservable ? 1 : 0;\n const themePrimaryColor = findBy(\n { key: \"primary_color\" },\n theme?.properties\n )?.value;\n\n const options = {\n save,\n key: payment.publicKey,\n order_id: payment.orderIdentifier,\n customer_id: payment.customerIdentifier,\n prefill: { name, email },\n modal: { confirm_close: true, ondismiss: onFailedPayment },\n handler: handlePayment,\n theme: { color: themePrimaryColor ?? \"#0da84c\" },\n };\n\n return openRazorpayCheckout(\n mergeDeepLeft(RAZORPAY_PAYMENT_BUTTON_OPTIONS, options)\n );\n };\n\n const { isPending, mutate: createRazorpayOrder } = useCreateRazorpayPayment({\n onSuccess: handleSuccess,\n });\n\n const handleClick = () => {\n onBeforePayment();\n const payload = {\n payableId,\n payableType,\n discountCode,\n customAmount,\n customerAttributes: { email, name },\n };\n createRazorpayOrder(payload);\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.pay\")}\n loading={isPending || isLoading}\n onClick={handleClick}\n />\n );\n};\n\nexport default RazorpayPaymentButton;\n"],"names":["loadScript","src","Promise","resolve","script","document","createElement","onload","onerror","body","appendChild","RazorpayPaymentButton","_ref","label","payableId","discountCode","email","customAmount","isDisabled","isLoading","name","_ref$isCardPreservabl","isCardPreservable","_ref$theme","theme","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onSuccessfulPaym","onSuccessfulPayment","_ref$onFailedPayment","onFailedPayment","_useTranslation","useTranslation","t","openRazorpayCheckout","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","options","checkout","wrap","_callee$","_context","prev","next","sent","logger","error","abrupt","window","Razorpay","open","stop","_x","apply","arguments","handlePayment","response","isNotPresent","razorpay_signature","handleSuccess","_ref3","_findBy","payment","status","save","themePrimaryColor","findBy","key","properties","value","publicKey","order_id","orderIdentifier","customer_id","customerIdentifier","prefill","modal","confirm_close","ondismiss","handler","color","mergeDeepLeft","RAZORPAY_PAYMENT_BUTTON_OPTIONS","_useCreateRazorpayPay","useCreateRazorpayPayment","onSuccess","isPending","createRazorpayOrder","mutate","handleClick","payload","customerAttributes","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAA;AAAA,EAAA,OACpB,IAAIC,OAAO,CAAC,UAAAC,OAAO,EAAI;AACrB,IAAA,IAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;IAC/CF,MAAM,CAACH,GAAG,GAAGA,GAAG;IAChBG,MAAM,CAACG,MAAM,GAAG,YAAM;MACpBJ,OAAO,CAAC,IAAI,CAAC;KACd;IAEDC,MAAM,CAACI,OAAO,GAAG,YAAM;MACrBL,OAAO,CAAC,KAAK,CAAC;KACf;AACDE,IAAAA,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACN,MAAM,CAAC;AACnC,GAAC,CAAC;AAAA,CAAA;AAEJ,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAerB;AAAA,EAAA,IAdJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,UAAU,GAAAN,IAAA,CAAVM,UAAU;IACVC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,I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AAS;IAAUC,mBAAmB,GAAAJ,qBAAA,CAA3BK,MAAM;AAIzB,EAAA,IAAMC,WAAW,GAAG,SAAdA,WAAWA,GAAS;AACxBnE,IAAAA,eAAe,EAAE;AACjB,IAAA,IAAMoE,OAAO,GAAG;AACdlF,MAAAA,SAAS,EAATA,SAAS;AACTY,MAAAA,WAAW,EAAXA,WAAW;AACXX,MAAAA,YAAY,EAAZA,YAAY;AACZE,MAAAA,YAAY,EAAZA,YAAY;AACZgF,MAAAA,kBAAkB,EAAE;AAAEjF,QAAAA,KAAK,EAALA,KAAK;AAAEI,QAAAA,IAAI,EAAJA;AAAK;KACnC;IACDyE,mBAAmB,CAACG,OAAO,CAAC;GAC7B;EAED,oBACEE,cAAA,CAACC,MAAM,EAAA;IACLC,QAAQ,EAAER,SAAS,IAAI1E,UAAW;AAClCL,IAAAA,KAAK,EAAEA,KAAK,IAAIuB,CAAC,CAAC,0BAA0B,CAAE;IAC9CiE,OAAO,EAAET,SAAS,IAAIzE,SAAU;AAChCmF,IAAAA,OAAO,EAAEP;AAAY,GACtB,CAAC;AAEN;;;;"}
|
package/dist/cjs/UpiPayment.js
CHANGED
|
@@ -52,6 +52,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
52
52
|
var fee = _ref.fee,
|
|
53
53
|
payableId = _ref.payableId,
|
|
54
54
|
discountCode = _ref.discountCode,
|
|
55
|
+
customAmount = _ref.customAmount,
|
|
55
56
|
handleCancel = _ref.handleCancel,
|
|
56
57
|
_ref$payableType = _ref.payableType,
|
|
57
58
|
payableType = _ref$payableType === void 0 ? null : _ref$payableType,
|
|
@@ -74,6 +75,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
74
75
|
onBeforePayment();
|
|
75
76
|
var payload = _objectSpread(_objectSpread({}, values), {}, {
|
|
76
77
|
payableId: payableId,
|
|
78
|
+
customAmount: customAmount,
|
|
77
79
|
payableType: payableType,
|
|
78
80
|
discountCode: discountCode
|
|
79
81
|
});
|
|
@@ -109,7 +111,7 @@ var UpiPayment = function UpiPayment(_ref) {
|
|
|
109
111
|
},
|
|
110
112
|
value: vpaIdToQrCodeValue(vpaId)
|
|
111
113
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
112
|
-
className: "mt-2
|
|
114
|
+
className: "w-full mt-2 text-center break-words",
|
|
113
115
|
style: "body2",
|
|
114
116
|
children: vpaId
|
|
115
117
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpiPayment.js","sources":["../../app/javascript/src/components/UpiPayment/constants.js","../../app/javascript/src/components/UpiPayment/utils.js","../../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, payableType, discountCode };\n createPayment(payload);\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"mt-2
|
|
1
|
+
{"version":3,"file":"UpiPayment.js","sources":["../../app/javascript/src/components/UpiPayment/constants.js","../../app/javascript/src/components/UpiPayment/utils.js","../../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n customAmount,\n handleCancel,\n payableType = null,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, customAmount, payableType, discountCode };\n createPayment(payload);\n };\n\n return (\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"w-full mt-2 text-center break-words\"\n style=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n required\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\"neetoPayments.upi.payment.transaction.placeholder\")}\n />\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: !dirty || isPending,\n loading: isPending,\n }}\n />\n </>\n )}\n </Form>\n );\n};\n\nexport default UpiPayment;\n"],"names":["VALIDATION_SCHEMA","yup","object","identifier","string","required","t","min","max","vpaIdToQrCodeValue","vpaId","concat","UpiPayment","_ref","fee","payableId","discountCode","customAmount","handleCancel","_ref$payableType","payableType","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","vpaIds","pluck","vpas","_useCreateUpiPayment","useCreateUpiPayment","onSuccess","onError","isPending","createPayment","mutate","handleSubmit","values","payload","_objectSpread","_jsx","Form","className","formikProps","onSubmit","initialValues","validationSchema","children","_ref2","dirty","_jsxs","_Fragment","Typography","style","count","length","isPresent","map","QRCodeImage","size","width","height","value","Input","label","name","placeholder","ActionBlock","cancelButtonProps","onClick","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,iBAAiB,GAAGC,cAAG,CAACC,MAAM,CAAC;AAC1CC,EAAAA,UAAU,EAAEF,cAAG,CACZG,MAAM,EAAE,CACRC,QAAQ,CAACC,SAAC,CAAC,gDAAgD,CAAC,CAAC,CAC7DC,GAAG,CAAC,CAAC,EAAED,SAAC,CAAC,qDAAqD,CAAC,CAAC,CAChEE,GAAG,CAAC,CAAC,EAAEF,SAAC,CAAC,qDAAqD,CAAC;AACpE,CAAC,CAAC;;ACTK,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGC,KAAK,EAAA;EAAA,OAAAC,eAAAA,CAAAA,MAAA,CAAoBD,KAAK,CAAA;AAAA,CAAE;;;;ACYlE,IAAME,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAUV;AAAA,EAAA,IATJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IACHC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IAAAC,gBAAA,GAAAN,IAAA,CACZO,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,gBAAA;IAAAE,oBAAA,GAAAR,IAAA,CAClBS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AA;UACJ9D,QAAQ,EAAA,IAAA;AACR+D,UAAAA,KAAK,EAAE9D,CAAC,CAAC,6CAA6C,CAAE;AACxD+D,UAAAA,IAAI,EAAC,YAAY;UACjBC,WAAW,EAAEhE,CAAC,CAAC,mDAAmD;AAAE,SACrE,CAAC,eACFsC,cAAA,CAAC2B,WAAW,EAAA;AACVC,UAAAA,iBAAiB,EAAE;AACjBJ,YAAAA,KAAK,EAAE9D,CAAC,CAAC,wCAAwC,CAAC;AAClDmE,YAAAA,OAAO,EAAEvD,YAAY;AACrBwD,YAAAA,QAAQ,EAAErC;WACV;AACFsC,UAAAA,iBAAiB,EAAE;AACjBP,YAAAA,KAAK,EAAE9D,CAAC,CAAC,0CAA0C,CAAC;AACpDoE,YAAAA,QAAQ,EAAE,CAACrB,KAAK,IAAIhB,SAAS;AAC7BuC,YAAAA,OAAO,EAAEvC;AACX;AAAE,SACH,CAAC;AAAA,OACF,CAAC;AAAA;AACJ,GACG,CAAC;AAEX;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-payments-frontend",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.39",
|
|
4
4
|
"description": "To manage payments across the neeto products.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-payments-nano",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"@babel/preset-typescript": "7.26.0",
|
|
59
59
|
"@babel/runtime": "7.26.10",
|
|
60
60
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
61
|
-
"@bigbinary/eslint-plugin-neeto": "1.6.
|
|
61
|
+
"@bigbinary/eslint-plugin-neeto": "1.6.4",
|
|
62
62
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
63
|
-
"@bigbinary/neeto-commons-frontend": "4.13.
|
|
64
|
-
"@bigbinary/neeto-editor": "1.47.
|
|
65
|
-
"@bigbinary/neeto-filters-frontend": "4.3.
|
|
66
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
67
|
-
"@bigbinary/neeto-molecules": "3.16.
|
|
68
|
-
"@bigbinary/neetoui": "8.3.
|
|
63
|
+
"@bigbinary/neeto-commons-frontend": "4.13.44",
|
|
64
|
+
"@bigbinary/neeto-editor": "1.47.17",
|
|
65
|
+
"@bigbinary/neeto-filters-frontend": "4.3.22",
|
|
66
|
+
"@bigbinary/neeto-icons": "1.20.50",
|
|
67
|
+
"@bigbinary/neeto-molecules": "3.16.67",
|
|
68
|
+
"@bigbinary/neetoui": "8.3.10",
|
|
69
69
|
"@emotion/is-prop-valid": "1.2.0",
|
|
70
70
|
"@faker-js/faker": "8.2.0",
|
|
71
71
|
"@honeybadger-io/js": "6.10.1",
|
|
@@ -171,12 +171,12 @@
|
|
|
171
171
|
"peerDependencies": {
|
|
172
172
|
"@babel/runtime": "7.26.10",
|
|
173
173
|
"@bigbinary/neeto-cist": "1.0.17",
|
|
174
|
-
"@bigbinary/neeto-commons-frontend": "4.13.
|
|
175
|
-
"@bigbinary/neeto-editor": "1.47.
|
|
176
|
-
"@bigbinary/neeto-filters-frontend": "4.3.
|
|
177
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
178
|
-
"@bigbinary/neeto-molecules": "3.16.
|
|
179
|
-
"@bigbinary/neetoui": "8.3.
|
|
174
|
+
"@bigbinary/neeto-commons-frontend": "4.13.44",
|
|
175
|
+
"@bigbinary/neeto-editor": "1.47.17",
|
|
176
|
+
"@bigbinary/neeto-filters-frontend": "4.3.22",
|
|
177
|
+
"@bigbinary/neeto-icons": "1.20.50",
|
|
178
|
+
"@bigbinary/neeto-molecules": "3.16.67",
|
|
179
|
+
"@bigbinary/neetoui": "8.3.10",
|
|
180
180
|
"@honeybadger-io/js": "6.10.1",
|
|
181
181
|
"@honeybadger-io/react": "6.1.25",
|
|
182
182
|
"@tailwindcss/container-queries": "^0.1.1",
|