Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processout.js",
"version": "1.9.7",
"version": "1.9.8",
"description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.",
"scripts": {
"build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js",
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic-checkout/dynamic-checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module ProcessOut {
this.widgetWrapper = document.createElement("div")
this.widgetWrapper.setAttribute("class", "dynamic-checkout-widget-wrapper")

if (this.paymentConfig.locale === "ar") {
if (Translations.isRtlLocale(this.paymentConfig.locale)) {
this.widgetWrapper.setAttribute("dir", "rtl")
}

Expand Down
6 changes: 6 additions & 0 deletions src/dynamic-checkout/payment-methods/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ module ProcessOut {
fontSize: "14px",
}

if (Translations.isRtlLocale(this.paymentConfig.locale)) {
// Hosted field iframes don't inherit the widget's dir="rtl",
// so the direction has to be passed to them explicitly
options.style.direction = "rtl"
}

options.placeholder = ""
options.expiryAutoNext = false
options.cardNumberAutoNext = true
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic-checkout/styles/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ const defaultStyles = `
}

.dynamic-checkout-widget-wrapper[dir="rtl"] .dco-payment-method-card-form-input-cvc {
padding-right: 0;
padding-right: 8px;
padding-left: 40px;
}

Expand Down
6 changes: 6 additions & 0 deletions src/dynamic-checkout/utils/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ module ProcessOut {
vi: vi,
}

static rtlLocales = ["ar"]

static getText(key: string, locale: string) {
const keys =
Translations.localeTranslationsMap[locale] || Translations.localeTranslationsMap.en

return keys[key] || ""
}

static isRtlLocale(locale: string) {
return Translations.rtlLocales.indexOf(locale) !== -1
}
Comment on lines 24 to +33
}
}
Loading