diff --git a/extensions/amp-subscriptions-google/0.1/test/test-amp-subscriptions-google.js b/extensions/amp-subscriptions-google/0.1/test/test-amp-subscriptions-google.js index 871a22c97fcab..095d29a7e4807 100644 --- a/extensions/amp-subscriptions-google/0.1/test/test-amp-subscriptions-google.js +++ b/extensions/amp-subscriptions-google/0.1/test/test-amp-subscriptions-google.js @@ -1174,9 +1174,10 @@ describes.realWin('amp-subscriptions-google', {amp: true}, (env) => { ); await platform.getEntitlements(); - expect(fetchStub).to.be.calledWith( - 'https://news.google.com/swg/_/api/v1/publication/example.org/entitlements' + expect(fetchStub.args[0][0]).to.match( + /https:\/\/news.google.com\/swg\/_\/api\/v1\/publication\/example\.org\/entitlements(.)*/ ); + expect(fetchStub.args[0][0]).not.contain('crypt='); }); it('should add encryptedDocumentKey parameter to url', async () => { @@ -1189,8 +1190,8 @@ describes.realWin('amp-subscriptions-google', {amp: true}, (env) => { getEncryptedDocumentKeyStub.callsFake(() => 'encryptedDocumentKey'); await platform.getEntitlements(); - expect(fetchStub).to.be.calledWith( - 'https://news.google.com/swg/_/api/v1/publication/example.org/entitlements?crypt=encryptedDocumentKey' + expect(fetchStub.args[0][0]).to.match( + /https:\/\/news\.google\.com\/swg\/_\/api\/v1\/publication\/example\.org\/entitlements(.)*\?crypt=encryptedDocumentKey/ ); }); }); diff --git a/third_party/subscriptions-project/config.js b/third_party/subscriptions-project/config.js index 8e490890d371c..a728266edc4c9 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.201 */ +/** Version: 0.1.22.203 */ /** * Copyright 2018 The Subscribe with Google Authors. All Rights Reserved. * diff --git a/third_party/subscriptions-project/swg-gaa.js b/third_party/subscriptions-project/swg-gaa.js index 74132bcda9ece..290234c9dd7c5 100644 --- a/third_party/subscriptions-project/swg-gaa.js +++ b/third_party/subscriptions-project/swg-gaa.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** Version: 0.1.22.201 */ +/** Version: 0.1.22.203 */ /** * Copyright 2018 The Subscribe with Google Authors. All Rights Reserved. * @@ -35,11 +35,15 @@ const I18N_STRINGS = { 'SHOWCASE_REGWALL_TITLE': { + 'bg': 'Получавайте повече с Google', 'bn': 'Google-এ আরও অনেক কিছুর সুবিধা পান', 'cs': 'Získejte s Googlem víc', + 'da': 'Få adgang til mere med Google', 'de': 'Immer gut informiert mit Google', + 'el': 'Αποκτήστε περισσότερα με την Google', 'en': 'Get more with Google', 'es': 'Disfruta de más artículos con Google', + 'es-419': 'Disfruta más artículos con Google', 'es-ar': 'Disfruta más artículos con Google', 'fr': 'Plus de contenus avec Google', 'fr-ca': 'Aller plus loin avec Google', @@ -47,20 +51,32 @@ const I18N_STRINGS = { 'it': 'Con Google puoi avere di più', 'ja': 'Google からのプレゼント', 'kn': 'Google ನಿಂದ ಹೆಚ್ಚಿನ ಪ್ರಯೋಜನ ಪಡೆಯಿರಿ', + 'lt': 'Get more with Google', + 'lv': 'Get more with Google', 'ml': 'Google ഉപയോഗിച്ച് കൂടുതൽ പ്രയോജനങ്ങൾ നേടൂ', 'mr': 'Google वापरून बरेच काही मिळवा', 'nl': 'Krijg meer met Google', + 'pl': 'Z Google dostajesz więcej', 'pt-br': 'Veja mais com o Google', 'pt-pt': 'Obtenha mais com a Google', + 'ro': 'Mai multe beneficii cu Google', + 'sk': 'Získajte viac s Googlom', + 'sl': 'Get more with Google', + 'sv': 'Få mer med Google', 'ta': 'Google மூலம் மேலும் பல கட்டுரைகளைப் படியுங்கள்', 'te': 'Googleతో మరిన్ని ప్రయోజనాలను పొందండి', }, 'SHOWCASE_REGWALL_DESCRIPTION': { + 'bg': 'За съдържанието обикновено се изисква плащане, но Google ви дава безплатен достъп до тази и други статии, когато се регистрирате за AP News{publication} с профила си в Google.', 'bn': 'এই কন্টেন্ট অ্যাক্সেস করার জন্য সাধারণত পেমেন্ট করতে হয় কিন্তু Google আপনাকে এই নিবন্ধ ফ্রিতে অ্যাক্সেস করতে এবং সেইসাথে অনেক কিছু পেতে সাহায্য করছে। এই সুবিধা পাওয়ার জন্য Google অ্যাকাউন্ট ব্যবহার করে আপনাকে AP News{publication}-এ রেজিস্টার করতে হবে।', 'cs': 'Tento obsah je obvykle zpoplatněn, ale pokud se do publikace AP News{publication} zaregistrujete pomocí účtu Google, získáte od Googlu přístup zdarma.', + 'da': 'Du skal normalt betale for at få adgang til dette indhold, men hvis du tilmelder dig AP News{publication} med din Google-konto, giver Google dig gratis adgang til artiklen og andet indhold.', '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.', + 'el': 'Συνήθως απαιτείται πληρωμή για αυτό το περιεχόμενο, αλλά η Google σας προσφέρει δωρεάν πρόσβαση σε αυτό το άρθρο και σε πολλά ακόμη, εάν εγγραφείτε στην έκδοση AP News{publication} με χρήση του Λογαριασμού σας Google.', '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': '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.', + 'es-419': + '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.', '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.', @@ -70,22 +86,33 @@ const I18N_STRINGS = { 'it': 'Generalmente questi contenuti sono a pagamento, ma Google ti offre accesso gratuito a questo articolo e ad altri articoli se ti registri a AP News{publication} usando il tuo Account Google.', 'ja': '通常、この記事をお読みいただくにはお支払いが必要ですが、お使いの Google アカウントで AP News{publication} に登録すると、この記事を無料でお読みいただけます。', 'kn': 'ಸಾಮಾನ್ಯವಾಗಿ ಈ ವಿಷಯಕ್ಕಾಗಿ ಹಣ ಪಾವತಿಸಬೇಕಾಗುತ್ತದೆ, ಆದರೆ ನೀವು AP News{publication} ಗೆ ನಿಮ್ಮ Google ಖಾತೆಯ ಮೂಲಕ ನೋಂದಾಯಿಸಿಕೊಂಡಾಗ Google ಈ ಲೇಖನ ಮತ್ತು ಇನ್ನಷ್ಟು ವಿಷಯಗಳಿಗೆ ನಿಮಗೆ ಉಚಿತವಾದ ಪ್ರವೇಶವನ್ನು ನೀಡುತ್ತದೆ.', + 'lt': '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.', + 'lv': '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.', 'ml': 'സാധാരണ ഈ ഉള്ളടക്കത്തിന് പണം നൽകേണ്ടതുണ്ട്, എന്നാൽ Google അക്കൗണ്ട് ഉപയോഗിച്ച് AP News{publication} എന്നതിൽ രജിസ്‌റ്റർ ചെയ്യുമ്പോൾ, ഈ ലേഖനത്തിലേക്കും മറ്റും Google നിങ്ങൾക്ക് സൗജന്യ ആക്‌സസ് നൽകുന്നു.', 'mr': 'या आशयासाठी सामान्यतः पेमेंट आवश्यक असते पण तुम्ही तुमचे Google खाते वापरून AP News{publication} मध्ये नोंदणी करता तेव्हा, Google तुम्हाला या लेखाचा आणि आणखी बऱ्याच आशयाचा विनामूल्य ॲक्सेस देते.', 'nl': 'Voor deze content moet je eigenlijk betalen. Maar Google geeft je kosteloos toegang tot dit artikel en andere content als je je registreert bij AP News{publication} via je Google-account.', + 'pl': 'Te treści zazwyczaj wymagają opłaty, ale dzięki Google możesz bezpłatnie przeczytać ten artykuł i korzystać z innych materiałów po zarejestrowaniu się w publikacji AP News{publication} za pomocą konta 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.', 'pt-pt': 'Geralmente, este conteúdo requer um pagamento, mas a Google concede-lhe acesso gratuito a este artigo e muito mais ao registar-se na publicação AP News{publication} com a sua Conta Google.', + 'ro': 'Acest conținut este de obicei cu plată, dar Google vă oferă acces gratuit la acest articol și la altele când vă înregistrați la AP News{publication} folosind Contul Google.', + 'sk': 'Tento obsah je obvykle platený, ale ak sa do publikácie AP News{publication} zaregistrujete účtom Google, získate od Googlu zdarma prístup k tomuto článku a ďalšie výhody.', + 'sl': '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.', + 'sv': 'Det krävs vanligtvis betalning för det här innehållet, men Google ger dig gratis åtkomst till artikeln och annat innehåll när du registrerar dig hos AP News{publication} med ditt Google-konto.', 'ta': 'வழக்கமாக இந்த உள்ளடக்கத்தை வாசிக்க கட்டணம் செலுத்த வேண்டியிருக்கும். ஆனால் AP News{publication} இல் உங்கள் Google கணக்கைப் பயன்படுத்திப் பதிவுசெய்யும்போது இந்தக் கட்டுரைக்கும் மேலும் பலவற்றுக்கும் Google இலவச அணுகலை வழங்குகிறது.', 'te': 'ఈ కంటెంట్‌కు మీరు సాధారణంగా పేమెంట్ చేయాల్సి ఉంటుంది, కానీ మీరు Google ఖాతాను ఉపయోగించి AP News{publication}తో రిజిస్టర్ చేసుకున్నప్పుడు, ఈ వార్తా కథనానికి ఇంకా మరెన్నో వాటికి Google, ఉచిత యాక్సెస్‌ను ఇస్తుంది.', }, 'SHOWCASE_REGWALL_PUBLISHER_SIGN_IN_BUTTON': { + 'bg': 'Вече имате профил?', 'bn': 'আপনার কি আগে থেকেই অ্যাকাউন্ট আছে?', 'cs': 'Už máte účet?', + 'da': 'Har du allerede en konto?', 'de': 'Du hast bereits ein Konto?', + 'el': 'Διαθέτετε ήδη λογαριασμό;', 'en': 'Already have an account?', 'es': '¿Ya tienes una cuenta?', + 'es-419': '¿Ya tienes una cuenta?', 'es-ar': '¿Ya tienes una cuenta?', 'fr': 'Vous avez déjà un compte ?', 'fr-ca': 'Vous avez déjà un compte?', @@ -93,20 +120,31 @@ const I18N_STRINGS = { 'it': 'Hai già un account?', 'ja': 'すでにアカウントをお持ちですか?', 'kn': 'ಈಗಾಗಲೇ ಖಾತೆಯೊಂದನ್ನು ಹೊಂದಿದ್ದೀರಾ?', + 'lt': 'Already have an account?', + 'lv': 'Already have an account?', 'ml': 'മുമ്പേ അക്കൗണ്ടുണ്ടോ?', 'mr': 'आधीपासून खाते आहे?', 'nl': 'Heb je al een account?', + 'pl': 'Masz już konto?', 'pt-br': 'Já tem uma conta?', 'pt-pt': 'Já tem uma conta?', + 'ro': 'Aveți deja un cont?', + 'sk': 'Už máte účet?', + 'sl': 'Already have an account?', + 'sv': 'Har du redan ett konto?', 'ta': 'ஏற்கெனவே கணக்கு உள்ளதா?', 'te': 'ఇప్పటికే ఖాతా ఉందా?', }, 'SHOWCASE_REGWALL_GOOGLE_SIGN_IN_BUTTON': { + 'bg': 'Вход с Google', 'bn': 'Google দিয়ে সাইন-ইন করুন', 'cs': 'Přihlásit se přes Google', + 'da': 'Log ind med Google', 'de': 'Über Google anmelden', + 'el': 'Σύνδεση μέσω Google', 'en': 'Sign in with Google', 'es': 'Iniciar sesión con Google', + 'es-419': 'Acceder con Google', 'es-ar': 'Acceder con Google', 'fr': 'Se connecter avec Google', 'fr-ca': 'Se connecter avec Google', @@ -114,36 +152,55 @@ const I18N_STRINGS = { 'it': 'Accedi con Google', 'ja': 'Google でログイン', 'kn': 'Google ಖಾತೆ ಬಳಸಿಕೊಂಡು ಸೈನ್ ಇನ್ ಮಾಡಿ', + 'lt': 'Sign in with Google', + 'lv': 'Sign in with Google', 'ml': 'Google ഉപയോഗിച്ച് സൈൻ ഇൻ ചെയ്യുക', 'mr': 'Google वापरून साइन इन करा', 'nl': 'Inloggen met Google', + 'pl': 'Zaloguj się przez Google', 'pt-br': 'Fazer login com o Google', 'pt-pt': 'Iniciar sessão com o Google', + 'ro': 'Conectați-vă cu Google', + 'sk': 'Prihlásiť sa účtom Google', + 'sl': 'Sign in with Google', + 'sv': 'Logga in med Google', 'ta': 'Google மூலம் உள்நுழைக', 'te': 'Googleతో సైన్ ఇన్ చేయండి', }, 'SHOWCASE_REGWALL_CASL': { - 'bn': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'bg': 'Прегледайте <a>Общите условия за канадското законодателство за борба със спама</a> на AP News{publication}', + 'bn': 'AP News{publication}-এর <a>CASL শর্ত</a> পর্যালোচনা করুন', 'cs': 'Prostudujte si <a>podmínky CASL</a> publikace AP News{publication}', + 'da': 'Gennemgå <a>CASL-vilkårene</a> (Canadian Anti-Spam Legislation, canadisk lovgivning vedrørende antispam) for AP News{publication}', 'de': '<a>CASL-Bedingungen</a> von AP News{publication} ansehen', + 'el': 'Ελέγξτε αν τηρούνται στη δημοσίευση AP News{publication} οι <a>Όροι CASL</a>', 'en': 'Review AP News{publication}\'s <a>CASL terms</a>', - 'es': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'es': 'Consulta los <a>términos de la CASL</a> de AP News{publication}', + 'es-419': + 'Consulta las <a>condiciones de CASL</a> de AP News{publication}', 'fr': 'Consultez les <a>Conditions d\'utilisation LCAP (Loi canadienne anti-pourriel)</a> de AP News{publication}', 'fr-ca': 'Consulter les <a>conditions d\'utilisation relatives à la Loi canadienne antipourriel (LCAP)</a> de la publication AP News{publication}', 'hi': 'AP News{publication} की <a>सीएएसएल (कैनेडियन एंटी-स्पैम लेजिस्लेशन) से जुड़ी शर्तों</a> के बारे में पढ़ें', 'it': 'Rileggi i <a>termini della legge CASL</a> di AP News{publication}', 'ja': 'AP News{publication}<a>CASL 規約</a>を見る', - 'kn': 'Review AP News{publication}\'s <a>CASL terms</a>', - 'ml': 'Review AP News{publication}\'s <a>CASL terms</a>', - 'mr': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'kn': 'AP News{publication}<a>CASL ನಿಯಮಗಳು</a> ಅನ್ನು ಪರಿಶೀಲಿಸಿ', + 'lt': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'lv': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'ml': 'AP News{publication} എന്നതിന്റെ <a>CASL നിബന്ധനകൾ</a> അവലോകനം ചെയ്യുക', + 'mr': 'AP News{publication} च्या <a>CASL अटी</a> यांचे पुनरावलोकन करा', 'nl': 'Bekijk de <a>CASL-voorwaarden</a> van AP News{publication}', + 'pl': 'Zapoznaj się z <a>warunkami CASL</a> publikacji AP News{publication}', 'pt-br': 'Confira os <a>termos da CASL</a> da publicação AP News{publication}', 'pt-pt': 'Analise os <a>termos da CASL</a> da publicação AP News{publication}', + 'ro': 'Examinați <a>Termenii CASL</a> ai AP News{publication}', + 'sk': 'Prečítajte si <a>podmienky CASL</a> publikácie AP News{publication}', + 'sl': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'sv': 'Läs <a>villkoren i lagstiftningen CASL</a> för AP News{publication}', 'ta': 'AP News{publication} இன் <a>CASL விதிமுறைகளைப்</a> பாருங்கள்', - 'te': 'Review AP News{publication}\'s <a>CASL terms</a>', + 'te': 'AP News{publication}‌కు సంబంధించిన <a>CASL నియమాల</a>ను రివ్యూ చేయండి', }, }; @@ -1512,7 +1569,7 @@ class GaaMeteringRegwall { if (e.data.stamp === POST_MESSAGE_STAMP) { if (e.data.command === POST_MESSAGE_COMMAND_USER) { // Pass along user details. - resolve(e.data.gaaUser || e.data.jwtPayload); + resolve(e.data.gaaUser || e.data.returnedJwt); } if (e.data.command === POST_MESSAGE_COMMAND_ERROR) { diff --git a/third_party/subscriptions-project/swg.js b/third_party/subscriptions-project/swg.js index 7abf8d1370537..1f1867d74cbfb 100644 --- a/third_party/subscriptions-project/swg.js +++ b/third_party/subscriptions-project/swg.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** Version: 0.1.22.201 */ +/** Version: 0.1.22.203 */ /** * Copyright 2018 The Subscribe with Google Authors. All Rights Reserved. * @@ -5020,7 +5020,7 @@ function feCached(url) { */ function feArgs(args) { return Object.assign(args, { - '_client': 'SwG 0.1.22.201', + '_client': 'SwG 0.1.22.203', }); } @@ -5563,6 +5563,11 @@ function parseSubscriptionResponse(deps, data, completeHandler) { (data['paymentRequest']['i'] || {})['productType'] || ProductType.SUBSCRIPTION; } + // Set productType if paymentRequest is not present, which happens + // if the pay flow was opened in redirect mode. + else if ('productType' in data) { + productType = data['productType']; + } } } if (raw && !swgData) { @@ -6338,7 +6343,7 @@ class ActivityPorts$1 { 'analyticsContext': context.toArray(), 'publicationId': pageConfig.getPublicationId(), 'productId': pageConfig.getProductId(), - '_client': 'SwG 0.1.22.201', + '_client': 'SwG 0.1.22.203', 'supportsEventManager': true, }, args || {} @@ -7228,7 +7233,7 @@ class AnalyticsService { context.setTransactionId(getUuid()); } context.setReferringOrigin(parseUrl(this.getReferrer_()).origin); - context.setClientVersion('SwG 0.1.22.201'); + context.setClientVersion('SwG 0.1.22.203'); context.setUrl(getCanonicalUrl(this.doc_)); const utmParams = parseQueryString(this.getQueryString_()); @@ -7551,7 +7556,7 @@ const SWG_I18N_STRINGS = { 'no': 'Bidra med Google', 'pl': 'Wesprzyj publikację przez Google', 'pt': 'Contribuir com o Google', - 'pt-br': 'Contribua com o Google', + 'pt-br': 'Contribua usando o Google', 'ru': 'Внести средства через Google', 'se': 'Bidra med Google', 'th': 'มีส่วนร่วมผ่าน Google', @@ -10645,7 +10650,7 @@ class MeterToastApi { this.meterClientType_ ?? MeterClientTypes.LICENSED_BY_GOOGLE ]; const iframeUrlParams = { - 'publication_id': this.deps_.pageConfig().getPublicationId(), + 'publicationId': this.deps_.pageConfig().getPublicationId(), 'origin': parseUrl(this.win_.location.href).origin, }; if (swgUserToken) { @@ -11784,6 +11789,9 @@ class EntitlementsManager { const signedData = json['signedEntitlements']; const decryptedDocumentKey = json['decryptedDocumentKey']; const swgUserToken = json['swgUserToken']; + if (swgUserToken) { + this.saveSwgUserToken_(swgUserToken); + } if (signedData) { const entitlements = this.getValidJwtEntitlements_( signedData, @@ -11792,13 +11800,11 @@ class EntitlementsManager { decryptedDocumentKey ); if (entitlements) { - this.saveSwgUserToken_(swgUserToken); return entitlements; } } else { const plainEntitlements = json['entitlements']; if (plainEntitlements) { - this.saveSwgUserToken_(swgUserToken); return this.createEntitlements_( '', plainEntitlements, @@ -12023,12 +12029,8 @@ class EntitlementsManager { * @private */ fetch_(params) { - // Get swgUserToken from getEntitlements params - const swgUserTokenParam = params?.encryption?.swgUserToken; - // Get swgUserToken from local storage if it is not in getEntitlements params - const swgUserTokenPromise = swgUserTokenParam - ? Promise.resolve(swgUserTokenParam) - : this.storage_.get(Constants$1.USER_TOKEN, true); + // Get swgUserToken from local storage + const swgUserTokenPromise = this.storage_.get(Constants$1.USER_TOKEN, true); let url = '/publication/' + encodeURIComponent(this.publicationId_) + this.action_; @@ -12057,6 +12059,17 @@ class EntitlementsManager { url = addQueryParam(url, 'sut', swgUserToken); } + /** @type {!GetEntitlementsParamsInternalDef} */ + const encodableParams = { + metering: { + clientTypes: [MeterClientTypes.METERED_BY_GOOGLE], + owner: this.publicationId_, + resource: { + hashedCanonicalUrl, + }, + }, + }; + // Add metering params. if ( this.publicationId_ && @@ -12068,22 +12081,15 @@ class EntitlementsManager { typeof meteringStateId === 'string' && meteringStateId.length > 0 ) { - /** @type {!GetEntitlementsParamsInternalDef} */ - const encodableParams = { - metering: { - clientTypes: [MeterClientTypes.LICENSED_BY_GOOGLE], - owner: this.publicationId_, - resource: { - hashedCanonicalUrl, - }, - // Publisher provided state. - state: { - id: meteringStateId, - attributes: [], - }, - token: this.getGaaToken_(), - }, + // Add publisher provided state and additional fields. + encodableParams.metering.state = { + id: meteringStateId, + attributes: [], }; + encodableParams.metering.clientTypes.push( + MeterClientTypes.LICENSED_BY_GOOGLE + ); + encodableParams.metering.token = this.getGaaToken_(); // Collect attributes. function collectAttributes({attributes, category}) { @@ -12120,16 +12126,6 @@ class EntitlementsManager { attributes: params.metering.state.customAttributes, category: 'custom', }); - - // Encode params. - this.encodedParams_ = base64UrlEncodeFromBytes( - utf8EncodeSync(JSON.stringify(encodableParams)) - ); - url = addQueryParam( - url, - this.encodedParamName_, - this.encodedParams_ - ); } else { warn( `SwG Entitlements: Please specify a metering state ID string, ideally a hash to avoid PII.` @@ -12137,6 +12133,12 @@ class EntitlementsManager { } } + // Encode params. + this.encodedParams_ = base64UrlEncodeFromBytes( + utf8EncodeSync(JSON.stringify(encodableParams)) + ); + url = addQueryParam(url, this.encodedParamName_, this.encodedParams_); + // Build URL. return serviceUrl(url); })