diff --git a/third_party/subscriptions-project/config.js b/third_party/subscriptions-project/config.js
index df89724d3b36..639d1261aab5 100644
--- a/third_party/subscriptions-project/config.js
+++ b/third_party/subscriptions-project/config.js
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/** Version: 0.1.22.145 */
+/** Version: 0.1.22.149 */
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*
diff --git a/third_party/subscriptions-project/swg.js b/third_party/subscriptions-project/swg.js
index be5b6552d62d..021c3b948b8d 100644
--- a/third_party/subscriptions-project/swg.js
+++ b/third_party/subscriptions-project/swg.js
@@ -1,6 +1,6 @@
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
-/*
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/** Version: 0.1.22.145 */
+/** Version: 0.1.22.149 */
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*
@@ -6232,7 +6232,7 @@ function feCached(url) {
*/
function feArgs(args) {
return Object.assign(args, {
- '_client': 'SwG 0.1.22.145',
+ '_client': 'SwG 0.1.22.149',
});
}
@@ -7351,7 +7351,7 @@ class ActivityPorts$1 {
'analyticsContext': context.toArray(),
'publicationId': pageConfig.getPublicationId(),
'productId': pageConfig.getProductId(),
- '_client': 'SwG 0.1.22.145',
+ '_client': 'SwG 0.1.22.149',
'supportsEventManager': true,
},
args || {}
@@ -8193,7 +8193,7 @@ class AnalyticsService {
context.setTransactionId(getUuid());
}
context.setReferringOrigin(parseUrl$1(this.getReferrer_()).origin);
- context.setClientVersion('SwG 0.1.22.145');
+ context.setClientVersion('SwG 0.1.22.149');
context.setUrl(getCanonicalUrl(this.doc_));
const utmParams = parseQueryString$1(this.getQueryString_());
@@ -10779,12 +10779,21 @@ class MeterToastApi {
.handleCancellations(this.activityIframeView_)
.catch((reason) => {
// Possibly call onConsumeCallback on all dialog cancellations to ensure unexpected
- // dialog closes don't give access without a meter consumed.
+ // dialog closures don't give access without a meter consumed.
if (this.onConsumeCallback_ && !this.onConsumeCallbackHandled_) {
this.onConsumeCallbackHandled_ = true;
this.onConsumeCallback_();
}
- throw reason;
+ // Don't throw on cancel errors since they happen when a user closes the toast,
+ // which is expected.
+ if (!isCancelError(reason)) {
+ // eslint-disable-next-line no-console
+ console /*OK*/
+ .error(
+ '[swg.js]: Error occurred during meter toast handling: ' + reason
+ );
+ throw reason;
+ }
});
return this.dialogManager_.openDialog().then((dialog) => {
this.setDialogBoxShadow_();
@@ -17228,30 +17237,41 @@ class WaitForSubscriptionLookupApi {
*/
// NOTE: Please don't edit this file directly!
-// You can (re)compile this file by running the "yarn build-i18n" shell command.
+// This document describes how to change i18n strings in swg-js: https://docs.google.com/document/d/1FMEKJ_TmjHhqON0krE4xhDbTEj0I0DnvzxMzB2cWUWA/edit?resourcekey=0-TQ7hPOzAD4hX8x9PfweGSg#heading=h.q9gi7t4h1tyj
const I18N_STRINGS = {
- 'GAA_REGWALL_TITLE': {
+ 'SHOWCASE_REGWALL_TITLE': {
'de': 'Immer gut informiert mit Google',
'en': 'Get more with Google',
- 'fr': 'Plus de possibilités avec Google',
+ 'es-ar': 'Disfruta más artículos con Google',
+ 'fr': 'Plus de contenus avec Google',
'pt-br': 'Veja mais com o Google',
},
- 'GAA_REGWALL_DESCRIPTION': {
+ 'SHOWCASE_REGWALL_DESCRIPTION': {
'de':
- 'Dieser Inhalt ist normalerweise kostenpflichtig. Google gewährt dir jedoch kostenlos Zugriff auf diesen Artikel und andere Inhalte, wenn du dich mit deinem Google-Konto bei AP News{publication} registrierst.',
+ 'Dieser Inhalt ist normalerweise kostenpflichtig. Google gewährt dir jedoch kostenlos Zugriff auf diesen Artikel und andere Inhalte, wenn du dich mit deinem Google-Konto bei AP News{publication} registrierst.',
'en':
'This content usually requires payment, but Google is giving you free access to this article and more when you register with AP News{publication} using your Google Account.',
+ 'es-ar':
+ 'Normalmente, es necesario pagar para ver este contenido, pero Google te ofrece acceso gratuito a este y otros artículos si te registras en AP News{publication} con tu Cuenta de Google.',
'fr':
- 'Ce contenu est généralement payant, mais vous pouvez lire cet article et d'autres contenus gratuitement grâce à Google en vous inscrivant sur AP News{publication} avec votre compte Google.',
+ 'Ce contenu est généralement payant, mais vous pouvez lire cet article et d\'autres contenus gratuitement grâce à Google en vous inscrivant sur AP News{publication} avec votre compte Google.',
'pt-br':
- 'Normalmente, é preciso pagar por este conteúdo. Porém, basta você se registrar na publicação AP News{publication} usando sua Conta do Google para ter acesso gratuito a esta matéria e muito mais.',
+ 'Normalmente, é preciso pagar por este conteúdo. Porém, basta você se registrar na publicação AP News{publication} usando sua Conta do Google para ter acesso gratuito a esta matéria e muito mais.',
},
- 'GAA_REGWALL_PUBLISHER_SIGN_IN_BUTTON': {
+ 'SHOWCASE_REGWALL_PUBLISHER_SIGN_IN_BUTTON': {
'de': 'Du hast bereits ein Konto?',
'en': 'Already have an account?',
- 'fr': 'Vous avez déjà un compte ?',
- 'pt-br': 'Já tem uma conta?',
+ 'es-ar': '¿Ya tienes una cuenta?',
+ 'fr': 'Vous avez déjà un compte ?',
+ 'pt-br': 'Já tem uma conta?',
+ },
+ 'SHOWCASE_REGWALL_GOOGLE_SIGN_IN_BUTTON': {
+ 'de': 'Über Google anmelden',
+ 'en': 'Sign in with Google',
+ 'es-ar': 'Acceder con Google',
+ 'fr': 'Se connecter avec Google',
+ 'pt-br': 'Fazer login com o Google',
},
};
@@ -17298,10 +17318,6 @@ const REGWALL_DIALOG_ID = 'swg-regwall-dialog';
/** ID for the Regwall title element. */
const REGWALL_TITLE_ID = 'swg-regwall-title';
-/** Class the Regwall uses to disable scrolling. */
-const REGWALL_DISABLE_SCROLLING_CLASS =
- 'gaa-metering-regwall--disable-scrolling';
-
/**
* HTML for the metering regwall dialog, where users can sign in with Google.
* The script creates a dialog based on this HTML.
@@ -17311,10 +17327,6 @@ const REGWALL_DISABLE_SCROLLING_CLASS =
*/
const REGWALL_HTML = `
-
$GAA_REGWALL_TITLE$
+
$SHOWCASE_REGWALL_TITLE$
- $GAA_REGWALL_DESCRIPTION$
+ $SHOWCASE_REGWALL_DESCRIPTION$
@@ -17504,8 +17500,14 @@ body {
#${GOOGLE_SIGN_IN_BUTTON_ID} .abcRioButton.abcRioButtonBlue .abcRioButtonIcon {
display: none;
}
-#${GOOGLE_SIGN_IN_BUTTON_ID} .abcRioButton.abcRioButtonBlue .abcRioButtonContents {
- font-size: 15px !important;
+/** Hides default "Sign in with Google" text. */
+#${GOOGLE_SIGN_IN_BUTTON_ID} .abcRioButton.abcRioButtonBlue .abcRioButtonContents span[id^=not_signed_] {
+ font-size: 0 !important;
+}
+/** Renders localized "Sign in with Google" text instead. */
+#${GOOGLE_SIGN_IN_BUTTON_ID} .abcRioButton.abcRioButtonBlue .abcRioButtonContents span[id^=not_signed_]::before {
+ content: '$SHOWCASE_REGWALL_GOOGLE_SIGN_IN_BUTTON$';
+ font-size: 15px;
}
`;
@@ -17550,7 +17552,7 @@ class GaaMeteringRegwall {
* @return {!Promise}
*/
static show({iframeUrl}) {
- const queryString = GaaMeteringRegwall.getQueryString_();
+ const queryString = GaaUtils.getQueryString();
if (!queryStringHasFreshGaaParams(queryString)) {
const errorMessage =
'[swg-gaa.js:GaaMeteringRegwall.show]: URL needs fresh GAA params.';
@@ -17586,6 +17588,11 @@ class GaaMeteringRegwall {
* @param {{ iframeUrl: string }} params
*/
static render_({iframeUrl}) {
+ const languageCode = getLanguageCodeFromElement(self.document.body);
+
+ // Tell the iframe which language to render.
+ iframeUrl = addQueryParam(iframeUrl, 'lang', languageCode);
+
const containerEl = /** @type {!HTMLDivElement} */ (self.document.createElement(
'div'
));
@@ -17610,16 +17617,16 @@ class GaaMeteringRegwall {
iframeUrl
)
.replace(
- '$GAA_REGWALL_TITLE$',
- msg(I18N_STRINGS['GAA_REGWALL_TITLE'], containerEl)
+ '$SHOWCASE_REGWALL_TITLE$',
+ I18N_STRINGS['SHOWCASE_REGWALL_TITLE'][languageCode]
)
.replace(
- '$GAA_REGWALL_DESCRIPTION$',
- msg(I18N_STRINGS['GAA_REGWALL_DESCRIPTION'], containerEl)
+ '$SHOWCASE_REGWALL_DESCRIPTION$',
+ I18N_STRINGS['SHOWCASE_REGWALL_DESCRIPTION'][languageCode]
)
.replace(
- '$GAA_REGWALL_PUBLISHER_SIGN_IN_BUTTON$',
- msg(I18N_STRINGS['GAA_REGWALL_PUBLISHER_SIGN_IN_BUTTON'], containerEl)
+ '$SHOWCASE_REGWALL_PUBLISHER_SIGN_IN_BUTTON$',
+ I18N_STRINGS['SHOWCASE_REGWALL_PUBLISHER_SIGN_IN_BUTTON'][languageCode]
);
containerEl.querySelector('ph')./*OK*/ innerHTML =
'' +
@@ -17631,9 +17638,6 @@ class GaaMeteringRegwall {
setImportantStyles(containerEl, {'opacity': 1});
GaaMeteringRegwall.addClickListenerOnPublisherSignInButton_();
- // Disable scrolling on the body element.
- self.document.body.classList.add(REGWALL_DISABLE_SCROLLING_CLASS);
-
// Focus on the title after the dialog animates in.
// This helps people using screenreaders.
const dialogEl = self.document.getElementById(REGWALL_DIALOG_ID);
@@ -17739,18 +17743,6 @@ class GaaMeteringRegwall {
if (regwallContainer) {
regwallContainer.remove();
}
-
- // Re-enable scrolling on the body element.
- self.document.body.classList.remove(REGWALL_DISABLE_SCROLLING_CLASS);
- }
-
- /**
- * Returns query string from current URL.
- * @private
- * @return {string}
- */
- static getQueryString_() {
- return self.location.search;
}
}
@@ -17763,9 +17755,17 @@ class GaaGoogleSignInButton {
* @param {{ allowedOrigins: !Array }} params
*/
static show({allowedOrigins}) {
+ // Optionally grab language code from URL.
+ const queryString = GaaUtils.getQueryString();
+ const queryParams = parseQueryString$1(queryString);
+ const languageCode = queryParams['lang'] || 'en';
+
// Apply iframe styles.
const styleEl = self.document.createElement('style');
- styleEl./*OK*/ innerText = GOOGLE_SIGN_IN_IFRAME_STYLES;
+ styleEl./*OK*/ innerText = GOOGLE_SIGN_IN_IFRAME_STYLES.replace(
+ '$SHOWCASE_REGWALL_GOOGLE_SIGN_IN_BUTTON$',
+ I18N_STRINGS['SHOWCASE_REGWALL_GOOGLE_SIGN_IN_BUTTON'][languageCode]
+ );
self.document.head.appendChild(styleEl);
// Promise a function that sends messages to the parent frame.
@@ -17866,6 +17866,17 @@ function configureGoogleSignIn() {
);
}
+class GaaUtils {
+ /**
+ * Returns query string from current URL.
+ * Tests can override this method to return different URLs.
+ * @return {string}
+ */
+ static getQueryString() {
+ return self.location.search;
+ }
+}
+
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*