From 8ff89334c662bb37bdff112b693a0f72d7194017 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Wed, 13 Mar 2024 16:58:39 +0530 Subject: [PATCH 1/2] feat: added prop for PaymentHeader Text (#226) --- src/LocaleString.res | 18 ------------------ src/PaymentElement.res | 14 ++++++++++---- src/Payments/CardPayment.res | 4 ++-- src/Types/PaymentType.res | 6 ++++++ 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/LocaleString.res b/src/LocaleString.res index 26de81dfc..25eaab7d5 100644 --- a/src/LocaleString.res +++ b/src/LocaleString.res @@ -65,8 +65,6 @@ type localeStrings = { saveWalletDetails: string, morePaymentMethods: string, useExistingPaymentMethods: string, - selectPaymentMethodLabel: string, - savedPaymentMethodsLabel: string, nicknameLabel: string, nicknamePlaceholder: string, } @@ -149,8 +147,6 @@ let defaultLocale = { saveWalletDetails: "Wallets details will be saved upon selection", morePaymentMethods: "More payment methods", useExistingPaymentMethods: "Use saved payment methods", - selectPaymentMethodLabel: "Select Payment Method", - savedPaymentMethodsLabel: "Saved Payment Methods", nicknameLabel: "Card Nickname", nicknamePlaceholder: "Card Nickname (Optional)", } @@ -235,8 +231,6 @@ let localeStrings = [ saveWalletDetails: "Wallets details will be saved upon selection", morePaymentMethods: "More payment methods", useExistingPaymentMethods: "Use saved payment methods", - selectPaymentMethodLabel: "Select Payment Method", - savedPaymentMethodsLabel: "Saved Payment Methods", nicknameLabel: "Card Nickname", nicknamePlaceholder: "Card Nickname (Optional)", }, @@ -318,8 +312,6 @@ let localeStrings = [ saveWalletDetails: "פרטי הארנק יישמרו בעת בחירה", morePaymentMethods: `אמצעי תשלום נוספים`, useExistingPaymentMethods: `השתמש באמצעי תשלום שמורים`, - selectPaymentMethodLabel: `בחר שיטת תשלום`, - savedPaymentMethodsLabel: `אמצעי תשלום שמורים`, nicknameLabel: `כינוי לכרטיס`, nicknamePlaceholder: `כינוי לכרטיס (אופציונלי)`, }, @@ -401,8 +393,6 @@ let localeStrings = [ saveWalletDetails: "Les détails du portefeuille seront enregistrés lors de la sélection", morePaymentMethods: `Plus de méthodes de paiement`, useExistingPaymentMethods: `Utiliser les modes de paiement enregistrés`, - selectPaymentMethodLabel: `Sélectionnez le mode de paiement`, - savedPaymentMethodsLabel: `Modes de paiement enregistrés`, nicknameLabel: `Pseudonyme de la carte`, nicknamePlaceholder: `Surnom de la carte (facultatif)`, }, @@ -484,8 +474,6 @@ let localeStrings = [ saveWalletDetails: "Wallets details will be saved upon selection", morePaymentMethods: "More payment methods", useExistingPaymentMethods: "Use saved payment methods", - selectPaymentMethodLabel: "Select Payment Method", - savedPaymentMethodsLabel: "Saved Payment Methods", nicknameLabel: "Card Nickname", nicknamePlaceholder: "Card Nickname (Optional)", }, @@ -567,8 +555,6 @@ let localeStrings = [ saveWalletDetails: "سيتم حفظ تفاصيل المحفظة عند الاختيار", morePaymentMethods: `المزيد من طرق الدفع`, useExistingPaymentMethods: `استخدم طرق الدفع المحفوظة`, - selectPaymentMethodLabel: `اختار طريقة الدفع`, - savedPaymentMethodsLabel: `طرق الدفع المحفوظة`, nicknameLabel: `الاسم علي الكارت`, nicknamePlaceholder: `اسم البطاقة (اختياري)`, }, @@ -650,8 +636,6 @@ let localeStrings = [ saveWalletDetails: "選択時にウォレットの詳細が保存されます", morePaymentMethods: `その他の支払い方法`, useExistingPaymentMethods: `保存した支払い方法を使用する`, - selectPaymentMethodLabel: `支払い方法を選択してください`, - savedPaymentMethodsLabel: `保存された支払い方法`, nicknameLabel: `カードのニックネーム`, nicknamePlaceholder: `カードニックネーム(任意)`, }, @@ -733,8 +717,6 @@ let localeStrings = [ saveWalletDetails: "Wallet-Details werden beim Auswählen gespeichert", morePaymentMethods: `Mehr Zahlungsmethoden`, useExistingPaymentMethods: `Gespeicherte Zahlungsarten nutzen`, - selectPaymentMethodLabel: `Wählen Sie die Zahlungsmethode`, - savedPaymentMethodsLabel: `Gespeicherte Zahlungsarten`, nicknameLabel: `Spitzname der Karte`, nicknamePlaceholder: `Kartenname (optional)`, }, diff --git a/src/PaymentElement.res b/src/PaymentElement.res index 11547b33a..26ff92ed9 100644 --- a/src/PaymentElement.res +++ b/src/PaymentElement.res @@ -14,7 +14,6 @@ let make = ( ~countryProps, ~paymentType: CardThemeType.mode, ) => { - let {localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) let sessionsObj = Recoil.useRecoilValueFromAtom(sessions) let { showCardFormByDefault, @@ -23,6 +22,7 @@ let make = ( customerPaymentMethods, displaySavedPaymentMethods, } = Recoil.useRecoilValueFromAtom(optionAtom) + let optionAtomValue = Recoil.useRecoilValueFromAtom(optionAtom) let isApplePayReady = Recoil.useRecoilValueFromAtom(isApplePayReady) let isGooglePayReady = Recoil.useRecoilValueFromAtom(isGooglePayReady) let methodslist = Recoil.useRecoilValueFromAtom(list) @@ -396,13 +396,19 @@ let make = ( }, [displaySavedPaymentMethods]) let paymentLabel = if displaySavedPaymentMethods { - showFields ? localeString.selectPaymentMethodLabel : localeString.savedPaymentMethodsLabel + showFields + ? optionAtomValue.paymentMethodsHeaderText + : optionAtomValue.savedPaymentMethodsHeaderText } else { - localeString.selectPaymentMethodLabel + optionAtomValue.paymentMethodsHeaderText } <> -
{React.string(paymentLabel)}
+ Option.isSome}> +
+ {paymentLabel->Option.getOr("")->React.string} +
+
{ + let isCustomerAcceptanceRequired = React.useMemo2(() => { if displaySavedPaymentMethodsCheckbox { isSaveCardsChecked || list.payment_type === SETUP_MANDATE } else { !(isGuestCustomer || list.payment_type === NORMAL) } - }, [isSaveCardsChecked]) + }, (isSaveCardsChecked, list.payment_type)) let submitCallback = React.useCallback6((ev: Window.event) => { let json = ev.data->Js.Json.parseExn diff --git a/src/Types/PaymentType.res b/src/Types/PaymentType.res index 86246d00a..97d41f92b 100644 --- a/src/Types/PaymentType.res +++ b/src/Types/PaymentType.res @@ -158,6 +158,8 @@ type options = { showCardFormByDefault: bool, billingAddress: billingAddress, sdkHandleConfirmPayment: sdkHandleConfirmPayment, + paymentMethodsHeaderText?: string, + savedPaymentMethodsHeaderText?: string, } let defaultCardDetails = { scheme: None, @@ -926,6 +928,8 @@ let itemToObjMapper = (dict, logger) => { "sdkHandleOneClickConfirmPayment", "showCardFormByDefault", "sdkHandleConfirmPayment", + "paymentMethodsHeaderText", + "savedPaymentMethodsHeaderText", ], dict, "options", @@ -964,6 +968,8 @@ let itemToObjMapper = (dict, logger) => { sdkHandleConfirmPayment: dict ->getDictfromDict("sdkHandleConfirmPayment") ->getSdkHandleConfirmPaymentProps, + paymentMethodsHeaderText: ?getOptionString(dict, "paymentMethodsHeaderText"), + savedPaymentMethodsHeaderText: ?getOptionString(dict, "savedPaymentMethodsHeaderText"), } } From 806f904f6ad430d147298446cae2f7c0853a5bb4 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 13 Mar 2024 11:30:41 +0000 Subject: [PATCH 2/2] chore(release): 0.33.0 [skip ci] # [0.33.0](https://github.com/juspay/hyperswitch-web/compare/v0.32.0...v0.33.0) (2024-03-13) ### Features * added prop for PaymentHeader Text ([#226](https://github.com/juspay/hyperswitch-web/issues/226)) ([8ff8933](https://github.com/juspay/hyperswitch-web/commit/8ff89334c662bb37bdff112b693a0f72d7194017)) --- CHANGELOG.md | 7 ++ package-lock.json | 179 +++++++++++++++++++++++++++++++--------------- package.json | 2 +- 3 files changed, 129 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 412e3f73c..245a2eec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [0.33.0](https://github.com/juspay/hyperswitch-web/compare/v0.32.0...v0.33.0) (2024-03-13) + + +### Features + +* added prop for PaymentHeader Text ([#226](https://github.com/juspay/hyperswitch-web/issues/226)) ([8ff8933](https://github.com/juspay/hyperswitch-web/commit/8ff89334c662bb37bdff112b693a0f72d7194017)) + # [0.32.0](https://github.com/juspay/hyperswitch-web/compare/v0.31.6...v0.32.0) (2024-03-13) diff --git a/package-lock.json b/package-lock.json index b929fc307..ffcd1494c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2870,6 +2870,21 @@ "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -2887,6 +2902,40 @@ "strip-ansi": "^7.0.1" } }, + "string-width-cjs": { + "version": "npm:string-width@4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, "strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -2896,6 +2945,23 @@ "ansi-regex": "^6.0.1" } }, + "strip-ansi-cjs": { + "version": "npm:strip-ansi@6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + } + } + }, "wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -2906,6 +2972,60 @@ "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } + }, + "wrap-ansi-cjs": { + "version": "npm:wrap-ansi@7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + } + } } } }, @@ -20843,17 +20963,6 @@ "strip-ansi": "^6.0.1" } }, - "string-width-cjs": { - "version": "npm:string-width@4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, "string.prototype.matchall": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", @@ -20941,15 +21050,6 @@ "ansi-regex": "^5.0.1" } }, - "strip-ansi-cjs": { - "version": "npm:strip-ansi@6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, "strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -23517,43 +23617,6 @@ } } }, - "wrap-ansi-cjs": { - "version": "npm:wrap-ansi@7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index e2bd39cdf..41313e4e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.32.0", + "version": "0.33.0", "main": "index.js", "private": true, "dependencies": {