Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwG Release 0.1.22.77 #25135

Merged
merged 8 commits into from Oct 18, 2019
2 changes: 1 addition & 1 deletion third_party/subscriptions-project/config.js
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** Version: 0.1.22.76 */
/** Version: 0.1.22.77 */
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*
Expand Down
264 changes: 114 additions & 150 deletions third_party/subscriptions-project/swg.js
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** Version: 0.1.22.76 */
/** Version: 0.1.22.77 */
/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*
Expand Down Expand Up @@ -2860,118 +2860,6 @@ var activityPorts_2 = activityPorts.ActivityIframePort;
var activityPorts_11 = activityPorts.createAbortError;
var activityPorts_12 = activityPorts.isAbortError;

/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Debug logger, only log message if #swg.log=1
* @param {...*} var_args [decription]
*/

/* eslint-disable */

function debugLog(var_args) {
if (/swg.debug=1/.test(self.location.hash)) {
const logArgs = Array.prototype.slice.call(arguments, 0);
logArgs.unshift('[Subscriptions]');
log.apply(log, logArgs);
}
}

/**
* @param {...*} var_args [description]
*/
function log(var_args) {
console.log.apply(console, arguments);
}

/**
* Throws an error if the first argument isn't trueish.
*
* Supports argument substitution into the message via %s placeholders.
*
* Throws an error object that has two extra properties:
* - associatedElement: This is the first element provided in the var args.
* It can be used for improved display of error messages.
* - messageArray: The elements of the substituted message as non-stringified
* elements in an array. When e.g. passed to console.error this yields
* native displays of things like HTML elements.
*
* @param {T} shouldBeTrueish The value to assert. The assert fails if it does
* not evaluate to true.
* @param {string=} opt_message The assertion message
* @param {...*} var_args Arguments substituted into %s in the message.
* @return {T} The value of shouldBeTrueish.
* @template T
*/
function assert(shouldBeTrueish, opt_message, var_args) {
let firstElement;
if (!shouldBeTrueish) {
const message = opt_message || 'Assertion failed';
const splitMessage = message.split('%s');
const first = splitMessage.shift();
let formatted = first;
const messageArray = [];
pushIfNonEmpty(messageArray, first);
for (let i = 2; i < arguments.length; i++) {
const val = arguments[i];
if (val && val.tagName) {
firstElement = val;
}
const nextConstant = splitMessage.shift();
messageArray.push(val);
pushIfNonEmpty(messageArray, nextConstant.trim());
formatted += toString(val) + nextConstant;
}
const e = new Error(formatted);
e.fromAssert = true;
e.associatedElement = firstElement;
e.messageArray = messageArray;
throw e;
}
return shouldBeTrueish;
}

/**
* @param {!Array} array
* @param {*} val
*/
function pushIfNonEmpty(array, val) {
if (val != '') {
array.push(val);
}
}

function toString(val) {
// Do check equivalent to `val instanceof Element` without cross-window bug
if (val && val.nodeType == 1) {
return val.tagName.toLowerCase() + (val.id ? '#' + val.id : '');
}
return /** @type {string} */ (val);
}

var log_1 = {
assert,
debugLog,
log
};
var log_2 = log_1.assert;
var log_3 = log_1.debugLog;
var log_4 = log_1.log;

/**
* Copyright 2019 The Subscribe with Google Authors. All Rights Reserved.
*
Expand Down Expand Up @@ -3096,24 +2984,6 @@ class ActivityIframePort$1 {
return this.iframePort_.onResizeRequest(callback);
}

/**
* Sends a message to the host.
* @param {!Object} payload
*/
messageDeprecated(payload) {
this.iframePort_.message(payload);
log_3('WARNING: messageDeprecated() is deprecated');
}

/**
* Registers a callback to receive messages from the host.
* @param {function(!Object)} callback
*/
onMessageDeprecated(callback) {
this.callbackOriginal_ = callback;
log_3('WARNING: use of deprecated API onMessageDeprecated()');
}

/**
* @param {!../proto/api_messages.Message} request
*/
Expand Down Expand Up @@ -3253,6 +3123,117 @@ class ActivityPorts$1 {
}
}

/**
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Debug logger, only log message if #swg.log=1
* @param {...*} var_args [decription]
*/

/* eslint-disable */

function debugLog(var_args) {
if (/swg.debug=1/.test(self.location.hash)) {
const logArgs = Array.prototype.slice.call(arguments, 0);
logArgs.unshift('[Subscriptions]');
log.apply(log, logArgs);
}
}

/**
* @param {...*} var_args [description]
*/
function log(var_args) {
console.log.apply(console, arguments);
}

/**
* Throws an error if the first argument isn't trueish.
*
* Supports argument substitution into the message via %s placeholders.
*
* Throws an error object that has two extra properties:
* - associatedElement: This is the first element provided in the var args.
* It can be used for improved display of error messages.
* - messageArray: The elements of the substituted message as non-stringified
* elements in an array. When e.g. passed to console.error this yields
* native displays of things like HTML elements.
*
* @param {T} shouldBeTrueish The value to assert. The assert fails if it does
* not evaluate to true.
* @param {string=} opt_message The assertion message
* @param {...*} var_args Arguments substituted into %s in the message.
* @return {T} The value of shouldBeTrueish.
* @template T
*/
function assert(shouldBeTrueish, opt_message, var_args) {
let firstElement;
if (!shouldBeTrueish) {
const message = opt_message || 'Assertion failed';
const splitMessage = message.split('%s');
const first = splitMessage.shift();
let formatted = first;
const messageArray = [];
pushIfNonEmpty(messageArray, first);
for (let i = 2; i < arguments.length; i++) {
const val = arguments[i];
if (val && val.tagName) {
firstElement = val;
}
const nextConstant = splitMessage.shift();
messageArray.push(val);
pushIfNonEmpty(messageArray, nextConstant.trim());
formatted += toString(val) + nextConstant;
}
const e = new Error(formatted);
e.fromAssert = true;
e.associatedElement = firstElement;
e.messageArray = messageArray;
throw e;
}
return shouldBeTrueish;
}

/**
* @param {!Array} array
* @param {*} val
*/
function pushIfNonEmpty(array, val) {
if (val != '') {
array.push(val);
}
}

function toString(val) {
// Do check equivalent to `val instanceof Element` without cross-window bug
if (val && val.nodeType == 1) {
return val.tagName.toLowerCase() + (val.id ? '#' + val.id : '');
}
return /** @type {string} */ (val);
}

var log_1 = {
assert,
debugLog,
log
};
var log_2 = log_1.assert;
var log_4 = log_1.log;

/**
* Copyright 2018 The Subscribe with Google Authors. All Rights Reserved.
*
Expand Down Expand Up @@ -4183,7 +4164,7 @@ function feCached(url) {
*/
function feArgs(args) {
return Object.assign(args, {
'_client': 'SwG 0.1.22.76',
'_client': 'SwG 0.1.22.77',
});
}

Expand Down Expand Up @@ -5140,24 +5121,6 @@ class ActivityIframeView extends View {
return this.portPromise_;
}

/**
* @param {!Object} data
*/
messageDeprecated(data) {
this.getPortPromise_().then(port => {
port.messageDeprecated(data);
});
}

/**
* Handles the message received by the port.
* @param {function(!Object<string, string|boolean>)} callback
*/
onMessageDeprecated(callback) {
this.getPortPromise_().then(port => {
port.onMessageDeprecated(callback);
});
}
/**
* @param {!function(new: T)} message
* @param {function(../proto/api_messages.Message)} callback
Expand Down Expand Up @@ -12757,6 +12720,7 @@ class PaymentsAsyncClient {
PayFrameHelper.postMessage({
'eventType': PostMessageEventType.LOG_LOAD_PAYMENT_DATA_API,
'clientLatencyStartMs': this.loadPaymentDataApiStartTimeMs_,
'buyFlowMode': this.buyFlowMode_,
});
})
.catch(result => {
Expand Down