diff --git a/content/messages/IT/long_term_nq.json b/content/messages/IT/long_term_nq.json new file mode 100644 index 0000000000..8156489da5 --- /dev/null +++ b/content/messages/IT/long_term_nq.json @@ -0,0 +1,28 @@ +{ + "meta": { + "offerCountry": "IT", + "offerType": "PAY_LATER_LONG_TERM", + "offerTerm": "{total_payments}", + "lander": "https://www.paypal.com/credit-presentment/lander/modal", + "variables": { + "offer_id": "${CREDIT_OFFERS_DS.offer_id}", + "vendor_financing_id": "${CREDIT_OFFERS_DS.vendor_financing_id}", + "financing_code": "${CREDIT_OFFERS_DS.financing_code}", + "formattedPeriodicPayment": "${CREDIT_OFFERS_DS.formattedPeriodicPayment}", + "formattedMinAmount": "${CREDIT_OFFERS_DS.formattedMinAmount}", + "formattedMaxAmount": "${CREDIT_OFFERS_DS.formattedMaxAmount}" + } + }, + "headline": [ + ["Acquista ora, paga dopo.", ["default", "xsmall"]], + ["Acquista ora e paga dopo.", ["xsmall.2"]], + [ + "Paga gli acquisti tra {formattedMinAmount} e {formattedMaxAmount} a rate mensili.", + ["small", "medium", "large", "xlarge"] + ] + ], + "subHeadline": [], + "disclaimer": [ + ["Scopri di più", ["default"]] + ] +} diff --git a/content/messages/IT/long_term_q.json b/content/messages/IT/long_term_q.json new file mode 100644 index 0000000000..d100e87ad9 --- /dev/null +++ b/content/messages/IT/long_term_q.json @@ -0,0 +1,24 @@ +{ + "meta": { + "offerCountry": "IT", + "offerType": "PAY_LATER_LONG_TERM", + "messageType": "LONG_TERM:Q", + "offerTerm": "{total_payments}", + "lander": "https://www.paypal.com/credit-presentment/lander/modal", + "variables": { + "offer_id": "${CREDIT_OFFERS_DS.offer_id}", + "vendor_financing_id": "${CREDIT_OFFERS_DS.vendor_financing_id}", + "financing_code": "${CREDIT_OFFERS_DS.financing_code}", + "formattedPeriodicPayment": "${CREDIT_OFFERS_DS.formattedPeriodicPayment}", + "formattedMinAmount": "${CREDIT_OFFERS_DS.formattedMinAmount}", + "formattedMaxAmount": "${CREDIT_OFFERS_DS.formattedMaxAmount}" + } + }, + "headline": [ + ["Acquista ora, paga dopo.", ["default", "xsmall"]], + ["Acquista ora e paga dopo.", ["xsmall.2"]], + [["Paga fino a 24 rate mensili."], ["small", "medium", "large", "xlarge"]] + ], + "subHeadline": [], + "disclaimer": [["Scopri di più", ["default"]]] +} diff --git a/src/server/locale/IT/mutations/index.js b/src/server/locale/IT/mutations/index.js index f369371961..3e0b20b5cb 100644 --- a/src/server/locale/IT/mutations/index.js +++ b/src/server/locale/IT/mutations/index.js @@ -1,10 +1,18 @@ // mutations import here. +import longTermQ from './long_term_q'; +import longTermNq from './long_term_nq'; import shortTermQ from './short_term_q'; import shortTermNq from './short_term_nq'; import shortTermNoAmount from './short_term_no_amount'; export default function getMutations(id, type) { switch (id) { + case 'LONG_TERM:Q': + case 'PLLT_SQ': + return longTermQ[type]; + case 'LONG_TERM:NQ': + case 'PLLT_NQ': + return longTermNq[type]; case 'SHORT_TERM:Q': case 'PLST_SQ': return shortTermQ[type]; diff --git a/src/server/locale/IT/mutations/long_term_nq.js b/src/server/locale/IT/mutations/long_term_nq.js new file mode 100644 index 0000000000..1b7282cbc7 --- /dev/null +++ b/src/server/locale/IT/mutations/long_term_nq.js @@ -0,0 +1,160 @@ +import { flexLogoMutations, textLogoMutations } from '../../../message/logoMutations'; +import Logo from '../../../message/logos'; +import { + altNoWrap, + logo20x1, + messageLogoWidth, + setLogoTop, + textWrap, + xSmallFallback +} from '../../../message/mediaQueries'; + +const headlineBreaks = [ + { + sizes: ['xsmall'] + }, + { + sizes: ['medium'], + breaks: ['rate'] + } +].reduce((acc, item) => { + const { sizes, breaks } = item; + sizes.forEach(size => { + acc.push({ + tag: size, + br: breaks + }); + }); + return acc; +}, []); + +export default { + 'layout:flex': [ + [ + 'default', + { + logo: Logo.PP_PAYPAL.WHITE, + headline: [ + { + tag: 'xsmall' + }, + { + tag: 'medium' + } + ], + disclaimer: ['default'], + styles: [] + } + ], + [ + 'ratio:20x1', + { + headline: [...headlineBreaks], + styles: [logo20x1()] + } + ], + [ + 'ratio:8x1', + { + headline: [...headlineBreaks] + } + ], + ...flexLogoMutations + ], + 'layout:text': [ + [ + 'default', + ({ textSize }) => ({ + styles: [ + textWrap(textSize * 48.5, textSize, 'IT'), + xSmallFallback(textSize * 23), + messageLogoWidth(false, textSize * 4, textSize * 1.25), + setLogoTop(textSize * 20) + ], + logo: Logo.PP_PAYPAL.COLOR, + headline: [ + { + tag: 'medium', + br: ['in', 'rate'] + }, + { tag: 'xsmall' } + ], + disclaimer: ['default'] + }) + ], + [ + 'logo.type:primary && logo.position:right', + ({ textSize }) => ({ + styles: [ + xSmallFallback(textSize * 17.4), + setLogoTop(textSize * 49), + messageLogoWidth(textSize * 6, textSize * 4, textSize * 1.25) + ] + }) + ], + [ + 'logo.type:primary && logo.position:top', + ({ textSize }) => ({ + styles: [xSmallFallback(textSize * 21), messageLogoWidth(textSize * 6, textSize * 4, textSize * 1.25)] + }) + ], + [ + 'logo.type:alternative', + ({ textSize }) => ({ + styles: [ + `@media screen and (max-width: ${textSize * 14}px) { .message__content { white-space: nowrap; }}`, + textWrap(textSize * 44, textSize, 'IT'), + xSmallFallback(textSize * 19), + altNoWrap(textSize * 14), + messageLogoWidth(textSize * 1.75, textSize * 4, textSize * 1.25) + ], + logo: Logo.PP_PAYPAL.COLOR[0] + }) + ], + [ + 'logo.type:none', + ({ textSize }) => ({ + styles: [xSmallFallback(textSize * 24)], + logo: false, + headline: [ + { + tag: 'medium.2', + br: ['rate', 'in\b'], + replace: [ + ['interessi.', 'interessi'], + ['dopo.', 'dopo'] + ] + }, + { + tag: 'xsmall.2', + br: ['dopo.'], + replace: [['dopo.', 'dopo']] + } + ] + }) + ], + [ + 'logo.type:inline', + ({ textSize }) => ({ + styles: [xSmallFallback(textSize * 24), `.message__logo { width: ${textSize * 4}px }`], + logo: Logo.NO_PP_MONOGRAM.COLOR, + headline: [ + { + tag: 'medium.2', + br: ['rate', 'in\b'], + replace: [ + ['interessi.', 'interessi'], + ['dopo.', 'dopo'] + ] + }, + { + tag: 'xsmall.2', + br: ['dopo.'], + replace: [['dopo.', 'dopo']] + } + ] + }) + ], + ...textLogoMutations + ] +}; diff --git a/src/server/locale/IT/mutations/long_term_q.js b/src/server/locale/IT/mutations/long_term_q.js new file mode 100644 index 0000000000..6f9b2447f9 --- /dev/null +++ b/src/server/locale/IT/mutations/long_term_q.js @@ -0,0 +1,175 @@ +import { flexLogoMutations, textLogoMutations } from '../../../message/logoMutations'; +import Logo from '../../../message/logos'; +import { + addPeriod, + altNoWrap, + logo20x1, + messageLogoWidth, + setLogoTop, + textWrap, + xSmallFallback +} from '../../../message/mediaQueries'; + +const headlineBreaks = [ + { + sizes: ['xsmall'] + }, + { + sizes: ['medium'], + breaks: ['rate'] + } +].reduce((acc, item) => { + const { sizes, breaks } = item; + sizes.forEach(size => { + acc.push({ + tag: size, + br: breaks + }); + }); + return acc; +}, []); + +export default { + 'layout:flex': [ + [ + 'default', + { + logo: Logo.PP_PAYPAL.WHITE, + headline: [ + { + tag: 'xsmall' + }, + { + tag: 'medium' + } + ], + disclaimer: ['default'], + styles: [] + } + ], + [ + 'ratio:20x1', + { + headline: [...headlineBreaks], + styles: [logo20x1()] + } + ], + [ + 'ratio:8x1', + { + headline: [...headlineBreaks] + } + ], + ...flexLogoMutations + ], + 'layout:text': [ + [ + 'default', + ({ textSize }) => ({ + styles: [ + textWrap(textSize * 37, textSize, 'IT'), + xSmallFallback(textSize * 18), + messageLogoWidth(false, textSize * 4, textSize * 1.25), + setLogoTop(textSize * 16), + addPeriod() + ], + logo: Logo.PP_PAYPAL.COLOR, + headline: [ + { + tag: 'medium', + br: ['rate'], + replace: [['mensili.', 'mensili']] + }, + { tag: 'xsmall' } + ], + disclaimer: ['default'] + }) + ], + [ + 'logo.type:primary && logo.position:right', + ({ textSize }) => ({ + styles: [ + `@media screen and (max-width: ${ + textSize * 18.5 + }px) { .message__headline > .tag--medium > span > span:first-child { white-space: normal; } }`, + xSmallFallback(textSize * 16), + setLogoTop(textSize * 37), + messageLogoWidth(textSize * 6, textSize * 4, textSize * 1.25), + addPeriod() + ] + }) + ], + [ + 'logo.type:primary && logo.position:top', + ({ textSize }) => ({ + styles: [ + `@media screen and (max-width: ${ + textSize * 18.5 + }px) { .message__headline > .tag--medium > span > span:first-child { white-space: normal; } }`, + xSmallFallback(textSize * 16), + messageLogoWidth(textSize * 6, textSize * 4, textSize * 1.25), + addPeriod() + ] + }) + ], + [ + 'logo.type:alternative', + ({ textSize }) => ({ + styles: [ + `@media screen and (max-width: ${textSize * 14}px) { .message__content { white-space: nowrap; }}`, + textWrap(textSize * 33.5, textSize, 'IT'), + xSmallFallback(textSize * 14), + altNoWrap(textSize * 14), + messageLogoWidth(textSize * 1.75, textSize * 4, textSize * 1.25), + addPeriod() + ], + logo: Logo.PP_PAYPAL.COLOR[0], + headline: [ + { + tag: 'medium', + br: ['rate'], + replace: [['mensili.', 'mensili']] + }, + { tag: 'xsmall' } + ] + }) + ], + [ + 'logo.type:none', + ({ textSize }) => ({ + styles: [xSmallFallback(textSize * 19)], + logo: false, + headline: [ + { + tag: 'medium', + br: ['rate'], + replace: [['interessi.', 'interessi']] + }, + { + tag: 'xsmall.2', + replace: [['dopo.', 'dopo']] + } + ] + }) + ], + [ + 'logo.type:inline', + ({ textSize }) => ({ + styles: [xSmallFallback(textSize * 19), `.message__logo { width: ${textSize * 4}px }`], + logo: Logo.NO_PP_MONOGRAM.COLOR, + headline: [ + { + tag: 'medium', + br: ['rate'], + replace: [['mensili.', 'mensili']] + }, + { + tag: 'xsmall.2', + replace: [['dopo.', 'dopo']] + } + ] + }) + ], + ...textLogoMutations + ] +}; diff --git a/src/utils/miscellaneous.js b/src/utils/miscellaneous.js index 5112e0c4a9..aee0a4a92f 100644 --- a/src/utils/miscellaneous.js +++ b/src/utils/miscellaneous.js @@ -215,6 +215,8 @@ export function getStandardProductOffer(offer) { case 'LT_SQEZ': case 'LT_SQEZ_RB': case 'LT_SQGZ': + case 'LONG_TERM:Q': + case 'LONG_TERM:NQ': case 'GPL:EQZ': case 'GPL:GTZ': case 'GPLQ:EQZ': diff --git a/utils/devServerProxy/config/IT/index.js b/utils/devServerProxy/config/IT/index.js index cc4244cb16..7a096b54f6 100644 --- a/utils/devServerProxy/config/IT/index.js +++ b/utils/devServerProxy/config/IT/index.js @@ -1,6 +1,85 @@ // Note that these values are solely mock structures for development purposes // that are not guaranteed to be reflective of what is in production export default { + DEV_IT_MULTI: { + country: 'IT', + // modalViews: [ + // { + // template: 'v2_product_list.json', + // product: 'PRODUCT_LIST' + // }, + // { + // template: 'short_term.json', + // product: 'PAY_LATER_SHORT_TERM' + // }, + // { + // template: 'long_term.json', + // offersTemplate: 'long_term.json', + // product: 'PAY_LATER_LONG_TERM' + // } + // ], + messageThresholds: [ + { + amount: 0, + template: 'short_term_no_amount.json', + product: 'PAY_LATER_SHORT_TERM' + }, + { + amount: 0.01, + template: 'short_term_nq.json', + product: 'PAY_LATER_SHORT_TERM' + }, + { + amount: 30, + template: 'short_term_q.json', + product: 'PAY_LATER_SHORT_TERM' + }, + { + amount: 500, + template: 'long_term_q.json', + product: 'PAY_LATER_LONG_TERM' + }, + { + amount: 5000.01, + template: 'long_term_nq.json', + product: 'PAY_LATER_LONG_TERM' + } + ], + offers: { + PAY_LATER_SHORT_TERM: [ + { + totalPayments: 3, + apr: 0, + nominalRate: 0, + minAmount: 30, + maxAmount: 2000 + } + ], + PAY_LATER_LONG_TERM: [ + { + totalPayments: 6, + apr: 14.99, + nominalRate: 0, + minAmount: 60, + maxAmount: 5000 + }, + { + totalPayments: 12, + apr: 14.99, + nominalRate: 0, + minAmount: 120, + maxAmount: 5000 + }, + { + totalPayments: 24, + apr: 14.99, + nominalRate: 0, + minAmount: 240, + maxAmount: 5000 + } + ] + } + }, DEV_IT_SHORT_TERM: { country: 'IT', modalViews: [ @@ -37,5 +116,37 @@ export default { } ] } + }, + DEV_IT_LONG_TERM: { + country: 'IT', + modalViews: [ + { + template: 'short_term.json', + product: 'PAY_LATER_SHORT_TERM' + } + ], + messageThresholds: [ + { + amount: 60, + template: 'long_term_q.json', + product: 'PAY_LATER_LONG_TERM' + }, + { + amount: 5000.01, + template: 'long_term_nq.json', + product: 'PAY_LATER_LONG_TERM' + } + ], + offers: { + PAY_LATER_LONG_TERM: [ + { + totalPayments: 24, + apr: 14.99, + nominalRate: 14.0491, + minAmount: 240, + maxAmount: 5000 + } + ] + } } };