actions-on-google
Advanced tools
Comparing version 1.5.1 to 1.6.0
{ | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"ecmaVersion": 7, | ||
"sourceType": "script" | ||
@@ -34,3 +34,4 @@ }, | ||
} | ||
}] | ||
}], | ||
"prefer-destructuring": "error" | ||
}, | ||
@@ -37,0 +38,0 @@ "plugins": [ |
@@ -24,16 +24,32 @@ /** | ||
const AssistantApp = require('./assistant-app'); | ||
const { AssistantApp, State } = require('./assistant-app'); | ||
const ActionsSdkApp = require('./actions-sdk-app'); | ||
const DialogflowApp = require('./dialogflow-app'); | ||
const Transactions = require('./transactions'); | ||
const Responses = require('./response-builder'); | ||
module.exports = { | ||
AssistantApp: AssistantApp.AssistantApp, | ||
State: AssistantApp.State, | ||
ActionsSdkApp: require('./actions-sdk-app'), | ||
DialogflowApp: require('./dialogflow-app'), | ||
Transactions: require('./transactions'), | ||
Responses: require('./response-builder'), | ||
AssistantApp, | ||
State, | ||
ActionsSdkApp, | ||
DialogflowApp, | ||
Transactions, | ||
Responses, | ||
// Backwards compatibility | ||
Assistant: AssistantApp.AssistantApp, | ||
ActionsSdkAssistant: require('./actions-sdk-app'), | ||
ApiAiAssistant: require('./dialogflow-app'), | ||
ApiAiApp: require('./dialogflow-app') | ||
get Assistant () { | ||
console.log('Importing the class name Assistant is *DEPRECATED*, use AssistantApp'); | ||
return AssistantApp; | ||
}, | ||
get ActionsSdkAssistant () { | ||
console.log('Importing the class name ActionsSdkAssistant is *DEPRECATED*, use ActionsSdkApp'); | ||
return ActionsSdkApp; | ||
}, | ||
get ApiAiAssistant () { | ||
console.log('Importing the class name ApiAiAssistant is *DEPRECATED*, use DialogflowApp'); | ||
return DialogflowApp; | ||
}, | ||
get ApiAiApp () { | ||
console.log('Importing the class name ApiAiApp is *DEPRECATED*, use DialogflowApp'); | ||
return DialogflowApp; | ||
} | ||
}; |
@@ -22,6 +22,4 @@ /** | ||
const error = Debug('actions-on-google:error'); | ||
const app = require('./assistant-app'); | ||
const AssistantApp = app.AssistantApp; | ||
const State = app.State; | ||
const transformToCamelCase = require('./utils/transform').transformToCamelCase; | ||
const { AssistantApp, State } = require('./assistant-app'); | ||
const { transformToCamelCase } = require('./utils/transform'); | ||
@@ -52,3 +50,3 @@ // Constants | ||
* @example | ||
* const ActionsSdkApp = require('actions-on-google').ActionsSdkApp; | ||
* const { ActionsSdkApp } = require('actions-on-google'); | ||
* const app = new ActionsSdkApp({request: request, response: response, | ||
@@ -75,3 +73,3 @@ * sessionStarted:sessionStarted}); | ||
this.body_.conversation.type && | ||
this.body_.conversation.type === this.ConversationStages.NEW && | ||
this.body_.conversation.type === this.ConversationTypes.NEW && | ||
this.sessionStarted_ && typeof this.sessionStarted_ === 'function') { | ||
@@ -82,5 +80,8 @@ this.sessionStarted_(); | ||
} | ||
this.extractUserStorage_(); | ||
} | ||
/** | ||
* @deprecated | ||
* Validates whether request is from Assistant through signature verification. | ||
@@ -109,3 +110,4 @@ * Uses Google-Auth-Library to verify authorization token against given | ||
debug('isRequestFromAssistant: projectId=%s', projectId); | ||
const googleAuthClient = require('./utils/auth').googleAuthClient; | ||
console.log('isRequestFromAssistant is *DEPRECATED*, use isRequestFromGoogle'); | ||
const { googleAuthClient } = require('./utils/auth'); | ||
const jwtToken = this.request_.get(CONVERSATION_API_SIGNATURE_HEADER); | ||
@@ -131,2 +133,46 @@ | ||
/** | ||
* Validates whether request is from Google through signature verification. | ||
* Uses Google-Auth-Library to verify authorization token against given | ||
* Google Cloud Project ID. Auth token is given in request header with key, | ||
* "Authorization". | ||
* | ||
* @example | ||
* const app = new ActionsSdkApp({request, response}); | ||
* app.isRequestFromGoogle('nodejs-cloud-test-project-1234') | ||
* .then(() => { | ||
* app.ask('Hey there, thanks for stopping by!'); | ||
* }) | ||
* .catch(err => { | ||
* response.status(400).send(); | ||
* }); | ||
* | ||
* @param {string} projectId Google Cloud Project ID for the Assistant app. | ||
* @return {Promise<LoginTicket>} Promise resolving with google-auth-library LoginTicket | ||
* if request is from a valid source, otherwise rejects with the error reason | ||
* for an invalid token. | ||
* @actionssdk | ||
*/ | ||
isRequestFromGoogle (projectId) { | ||
debug('isRequestFromGoogle: projectId=%s', projectId); | ||
const { googleAuthClient } = require('./utils/auth'); | ||
const jwtToken = this.request_.get(CONVERSATION_API_SIGNATURE_HEADER); | ||
return new Promise((resolve, reject) => { | ||
if (!jwtToken) { | ||
const errorMsg = 'No incoming API Signature JWT token'; | ||
error(errorMsg); | ||
reject(errorMsg); | ||
} | ||
googleAuthClient.verifyIdToken(jwtToken, projectId, (err, login) => { | ||
if (err) { | ||
error('ID token verification Failed: ' + err); | ||
reject(err); | ||
} else { | ||
resolve(login); | ||
} | ||
}); | ||
}); | ||
} | ||
/** | ||
* Gets the request Conversation API version. | ||
@@ -167,3 +213,3 @@ * | ||
} | ||
const rawInput = input.rawInputs[0]; | ||
const [rawInput] = input.rawInputs; | ||
if (!rawInput.query) { | ||
@@ -686,2 +732,3 @@ error('Missing query for user raw input'); | ||
} | ||
this.addUserStorageToResponse_(response); | ||
response.expectUserResponse = expectUserResponse; | ||
@@ -688,0 +735,0 @@ if (expectedInput) { |
@@ -22,6 +22,4 @@ /** | ||
const error = Debug('actions-on-google:error'); | ||
const app = require('./assistant-app'); | ||
const AssistantApp = app.AssistantApp; | ||
const State = app.State; | ||
const transformToCamelCase = require('./utils/transform').transformToCamelCase; | ||
const { AssistantApp, State } = require('./assistant-app'); | ||
const { transformToCamelCase } = require('./utils/transform'); | ||
@@ -63,3 +61,3 @@ // Constants | ||
* @example | ||
* const DialogflowApp = require('actions-on-google').DialogflowApp; | ||
* const { DialogflowApp } = require('actions-on-google'); | ||
* const app = new DialogflowApp({request: request, response: response, | ||
@@ -79,7 +77,10 @@ * sessionStarted:sessionStarted}); | ||
super(options, () => { | ||
const originalRequest = this.body_.originalRequest; | ||
if (!(originalRequest && originalRequest.data)) { | ||
if (!this.body_) { | ||
return null; | ||
} | ||
return originalRequest.data; | ||
const { originalRequest } = this.body_; | ||
if (!originalRequest) { | ||
return null; | ||
} | ||
return originalRequest.data || null; | ||
}); | ||
@@ -97,3 +98,3 @@ | ||
if (this.body_.originalRequest.data.conversation.type === | ||
this.ConversationStages.NEW && this.sessionStarted_ && | ||
this.ConversationTypes.NEW && this.sessionStarted_ && | ||
typeof this.sessionStarted_ === 'function') { | ||
@@ -105,2 +106,4 @@ this.sessionStarted_(); | ||
} | ||
this.extractUserStorage_(); | ||
} | ||
@@ -993,14 +996,13 @@ | ||
}; | ||
response.data = isStringResponse ? { | ||
google: { | ||
expectUserResponse: expectUserResponse, | ||
isSsml: this.isSsml_(textToSpeech), | ||
noInputPrompts: noInputs | ||
} | ||
const google = Object.assign({ | ||
expectUserResponse, | ||
noInputPrompts: noInputs | ||
}, isStringResponse ? { | ||
isSsml: this.isSsml_(textToSpeech) | ||
} : { | ||
google: { | ||
expectUserResponse: expectUserResponse, | ||
richResponse: textToSpeech, | ||
noInputPrompts: noInputs | ||
} | ||
richResponse: textToSpeech | ||
}); | ||
this.addUserStorageToResponse_(google); | ||
response.data = { | ||
}; | ||
@@ -1032,8 +1034,4 @@ if (expectUserResponse) { | ||
if (this.body_.result.contexts[i].name === ACTIONS_DIALOGFLOW_CONTEXT) { | ||
const parameters = this.body_.result.contexts[i].parameters; | ||
if (parameters) { | ||
this.data = parameters; | ||
} else { | ||
this.data = {}; | ||
} | ||
const { parameters } = this.body_.result.contexts[i]; | ||
this.data = parameters || {}; | ||
break; | ||
@@ -1040,0 +1038,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"main": "actions-on-google.js", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"license": "Apache-2.0", | ||
@@ -8,0 +8,0 @@ "author": "Google Inc.", |
@@ -7,2 +7,4 @@ # Actions On Google Client Library | ||
[](https://www.npmjs.org/package/actions-on-google) | ||
## Setup Instructions | ||
@@ -14,3 +16,3 @@ | ||
```javascript | ||
let ActionsSdkApp = require('actions-on-google').ActionsSdkApp; | ||
const { ActionsSdkApp } = require('actions-on-google'); | ||
``` | ||
@@ -28,3 +30,3 @@ | ||
```javascript | ||
let DialogflowApp = require('actions-on-google').DialogflowApp; | ||
const { DialogflowApp } = require('actions-on-google'); | ||
``` | ||
@@ -31,0 +33,0 @@ |
@@ -31,2 +31,18 @@ /** | ||
const ImageDisplays = { | ||
/** | ||
* Pads the gaps between the image and image frame with a blurred copy of the | ||
* same image. | ||
*/ | ||
DEFAULT: 'DEFAULT', | ||
/** | ||
* Fill the gap between the image and image container with white bars. | ||
*/ | ||
WHITE: 'WHITE', | ||
/** | ||
* Image is centered and resized so the image fits perfectly in the container. | ||
*/ | ||
CROPPED: 'CROPPED' | ||
}; | ||
/** | ||
@@ -89,2 +105,24 @@ * Simple Response type. | ||
/** | ||
* @typedef {Object} StructuredResponse | ||
* @property {OrderUpdate} orderUpdate | ||
*/ | ||
/** | ||
* @typedef {Object} RichResponseItemBasicCard | ||
* @property {BasicCard} basicCard | ||
*/ | ||
/** | ||
* @typedef {Object} RichResponseItemSimpleResponse | ||
* @property {SimpleResponse} simpleResponse | ||
*/ | ||
/** | ||
* @typedef {Object} RichResponseItemStructuredResponse | ||
* @property {StructuredResponse} structuredResponse | ||
*/ | ||
/** @typedef {RichResponseItemBasicCard | RichResponseItemSimpleResponse | RichResponseItemStructuredResponse} RichResponseItem */ | ||
/** | ||
* Class for initializing and constructing Rich Responses with chainable interface. | ||
@@ -102,3 +140,3 @@ */ | ||
* First item must be SimpleResponse. There can be at most one card. | ||
* @type {Array<SimpleResponse|BasicCard>} | ||
* @type {Array<RichResponseItem>} | ||
*/ | ||
@@ -380,2 +418,5 @@ this.items = []; | ||
} | ||
if (basicCard.imageDisplayOptions) { | ||
this.imageDisplayOptions = basicCard.imageDisplayOptions; | ||
} | ||
} | ||
@@ -459,2 +500,23 @@ } | ||
/** | ||
* Sets the display options for the image in this Basic Card. | ||
* Use one of the image display constants. If none is chosen, | ||
* ImageDisplays.DEFAULT will be enforced. | ||
* | ||
* @param {string} option The option for displaying the image. | ||
* @return {BasicCard} Returns current constructed BasicCard. | ||
*/ | ||
setImageDisplay (option) { | ||
switch (option) { | ||
case ImageDisplays.DEFAULT: | ||
case ImageDisplays.WHITE: | ||
case ImageDisplays.CROPPED: | ||
this.imageDisplayOptions = option; | ||
break; | ||
default: | ||
console.error(`Image display option ${option} is invalid`); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Adds a button below card. | ||
@@ -804,3 +866,4 @@ * | ||
OptionItem, | ||
isSsml | ||
isSsml, | ||
ImageDisplays | ||
}; |
@@ -43,3 +43,3 @@ /** | ||
* @typedef {Object} RejectionInfo | ||
* @property {string} type - One of Transaction.RejectionType. | ||
* @property {string} type - One of Transaction.ReasonType. | ||
* @property {string} reason - Reason for the order rejection. | ||
@@ -64,5 +64,3 @@ */ | ||
* @typedef {Object} TransitInfo | ||
* @property {Object} updatedTime - UTC timestamp of the transit update. | ||
* @property {number} updatedTime.seconds - Seconds since Unix epoch. | ||
* @property {number=} updatedTime.nanos - Partial seconds since Unix epoch. | ||
* @property {string} updatedTime - UTC timestamp of the transit update as an RFC 3339 string. | ||
*/ | ||
@@ -73,5 +71,3 @@ | ||
* @typedef {Object} FulfillmentInfo | ||
* @property {Object} deliveryTime - UTC timestamp of the fulfillment update. | ||
* @property {number} deliveryTime.seconds - Seconds since Unix epoch. | ||
* @property {number=} deliveryTime.nanos - Partial seconds since Unix epoch. | ||
* @property {string} deliveryTime - UTC timestamp of the fulfillment update as an RFC 3339 string. | ||
*/ | ||
@@ -137,3 +133,3 @@ | ||
* @typedef {Object} TransactionDecision | ||
* @property {string} userDecision - One of Transactions.ConfirmationDecision. | ||
* @property {string} userDecision - One of Transactions.TransactionUserDecision. | ||
* @property {Object} checkResult | ||
@@ -199,2 +195,3 @@ * @property {string} checkResult.resultType - One of Transactions.ResultType. | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.LineItemType} instead. | ||
*/ | ||
@@ -236,2 +233,41 @@ ItemType: { | ||
/** | ||
* List of possible item types. | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
LineItemType: { | ||
/** | ||
* Unspecified. | ||
*/ | ||
UNSPECIFIED: 'UNSPECIFIED', | ||
/** | ||
* Regular. | ||
*/ | ||
REGULAR: 'REGULAR', | ||
/** | ||
* Tax. | ||
*/ | ||
TAX: 'TAX', | ||
/** | ||
* Discount | ||
*/ | ||
DISCOUNT: 'DISCOUNT', | ||
/** | ||
* Gratuity | ||
*/ | ||
GRATUITY: 'GRATUITY', | ||
/** | ||
* Delivery | ||
*/ | ||
DELIVERY: 'DELIVERY', | ||
/** | ||
* Subtotal | ||
*/ | ||
SUBTOTAL: 'SUBTOTAL', | ||
/** | ||
* Fee. For everything else, there's fee. | ||
*/ | ||
FEE: 'FEE' | ||
}, | ||
/** | ||
* List of price types. | ||
@@ -292,2 +328,3 @@ * @readonly | ||
CustomerInfoProperties: { | ||
CUSTOMER_INFO_PROPERTY_UNSPECIFIED: 'CUSTOMER_INFO_PROPERTY_UNSPECIFIED', | ||
EMAIL: 'EMAIL' | ||
@@ -299,2 +336,3 @@ }, | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.TransactionUserDecision} instead. | ||
*/ | ||
@@ -321,2 +359,30 @@ ConfirmationDecision: { | ||
/** | ||
* List of possible order confirmation user decisions | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
TransactionUserDecision: { | ||
/** | ||
* Unspecified user decision. | ||
*/ | ||
UNKNOWN_USER_DECISION: 'UNKNOWN_USER_DECISION', | ||
/** | ||
* Order was approved by user. | ||
*/ | ||
ACCEPTED: 'ORDER_ACCEPTED', | ||
/** | ||
* Order was declined by user. | ||
*/ | ||
REJECTED: 'ORDER_REJECTED', | ||
/** | ||
* Order was not declined, but the delivery address was updated during | ||
* confirmation. | ||
*/ | ||
DELIVERY_ADDRESS_UPDATED: 'DELIVERY_ADDRESS_UPDATED', | ||
/** | ||
* Order was not declined, but the cart was updated during confirmation. | ||
*/ | ||
CART_CHANGE_REQUESTED: 'CART_CHANGE_REQUESTED' | ||
}, | ||
/** | ||
* List of possible order states. | ||
@@ -328,2 +394,6 @@ * @readonly | ||
/** | ||
* Order was created at the integrator's system. | ||
*/ | ||
CREATED: 'CREATED', | ||
/** | ||
* Order was rejected. | ||
@@ -357,2 +427,3 @@ */ | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.ActionType} instead. | ||
*/ | ||
@@ -395,8 +466,64 @@ OrderAction: { | ||
*/ | ||
REVIEW: 'REVIEW' | ||
REVIEW: 'REVIEW', | ||
/** | ||
* Customer Service. | ||
*/ | ||
CUSTOMER_SERVICE: 'CUSTOMER_SERVICE' | ||
}, | ||
/** | ||
* List of possible actions to take on the order. | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
ActionType: { | ||
/** | ||
* Unknown action. | ||
*/ | ||
UNKNOWN: 'UNKNOWN', | ||
/** | ||
* View details. | ||
*/ | ||
VIEW_DETAILS: 'VIEW_DETAILS', | ||
/** | ||
* Modify order. | ||
*/ | ||
MODIFY: 'MODIFY', | ||
/** | ||
* Cancel order. | ||
*/ | ||
CANCEL: 'CANCEL', | ||
/** | ||
* Return order. | ||
*/ | ||
RETURN: 'RETURN', | ||
/** | ||
* Exchange order. | ||
*/ | ||
EXCHANGE: 'EXCHANGE', | ||
/** | ||
* Email. | ||
*/ | ||
EMAIL: 'EMAIL', | ||
/** | ||
* Call. | ||
*/ | ||
CALL: 'CALL', | ||
/** | ||
* Reorder. | ||
*/ | ||
REORDER: 'REORDER', | ||
/** | ||
* Review. | ||
*/ | ||
REVIEW: 'REVIEW', | ||
/** | ||
* Customer Service. | ||
*/ | ||
CUSTOMER_SERVICE: 'CUSTOMER_SERVICE' | ||
}, | ||
/** | ||
* List of possible types of order rejection. | ||
* @readonly | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.ReasonType} instead. | ||
*/ | ||
@@ -414,2 +541,17 @@ RejectionType: { | ||
/** | ||
* List of possible reasons for order rejection. | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
ReasonType: { | ||
/** | ||
* Unknown | ||
*/ | ||
UNKNOWN: 'UNKNOWN', | ||
/** | ||
* Payment was declined. | ||
*/ | ||
PAYMENT_DECLINED: 'PAYMENT_DECLINED' | ||
}, | ||
/** | ||
* List of possible order state objects. | ||
@@ -477,2 +619,3 @@ * @readonly | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.DeliveryAddressUserDecision} instead. | ||
*/ | ||
@@ -494,5 +637,25 @@ DeliveryAddressDecision: { | ||
/** | ||
* List of possible user decisions to give delivery address. | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
DeliveryAddressUserDecision: { | ||
/** | ||
* Unknown. | ||
*/ | ||
UNKNOWN: 'UNKNOWN_USER_DECISION', | ||
/** | ||
* User granted delivery address. | ||
*/ | ||
ACCEPTED: 'ACCEPTED', | ||
/** | ||
* User denied to give delivery address. | ||
*/ | ||
REJECTED: 'REJECTED' | ||
}, | ||
/** | ||
* List of possible order location types. | ||
* @readonly | ||
* @enum {string} | ||
* @deprecated Use {@link TransactionValues.OrderLocationType} instead. | ||
*/ | ||
@@ -519,5 +682,40 @@ LocationType: { | ||
*/ | ||
DESTINATION: 'DESTINATION' | ||
DESTINATION: 'DESTINATION', | ||
/** | ||
* Pick up location of the order. | ||
*/ | ||
PICK_UP: 'PICK_UP' | ||
}, | ||
/** | ||
* List of possible order location types. | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
OrderLocationType: { | ||
/** | ||
* Unknown. | ||
*/ | ||
UNKNOWN: 'UNKNOWN', | ||
/** | ||
* Delivery location for an order. | ||
*/ | ||
DELIVERY: 'DELIVERY', | ||
/** | ||
* Business location of order provider. | ||
*/ | ||
BUSINESS: 'BUSINESS', | ||
/** | ||
* Origin of the order. | ||
*/ | ||
ORIGIN: 'ORIGIN', | ||
/** | ||
* Destination of the order. | ||
*/ | ||
DESTINATION: 'DESTINATION', | ||
/** | ||
* Pick up location of the order. | ||
*/ | ||
PICK_UP: 'PICK_UP' | ||
}, | ||
/** | ||
* List of possible order time types. | ||
@@ -544,3 +742,19 @@ * @readonly | ||
RESERVATION_SLOT: 'RESERVATION_SLOT' | ||
}, | ||
/** | ||
* List of possible tokenization types for the payment method | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
PaymentMethodTokenizationType: { | ||
/** | ||
* Unspecified tokenization type. | ||
*/ | ||
UNSPECIFIED_TOKENIZATION_TYPE: 'UNSPECIFIED_TOKENIZATION_TYPE', | ||
/** | ||
* Use external payment gateway tokenization API to tokenize selected payment method. | ||
*/ | ||
PAYMENT_GATEWAY: 'PAYMENT_GATEWAY' | ||
} | ||
}; | ||
@@ -729,3 +943,3 @@ | ||
* | ||
* @param {string} type One of TransactionValues.LocationType. | ||
* @param {string} type One of TransactionValues.OrderLocationType. | ||
* @param {Location} location Location to add. | ||
@@ -948,3 +1162,3 @@ * @return {Order} Returns current constructed Order. | ||
/** | ||
* Type of the item. One of TransactionValues.ItemType. | ||
* Type of the item. One of TransactionValues.LineItemType. | ||
* @type {string} | ||
@@ -1060,3 +1274,3 @@ */ | ||
* | ||
* @param {string} type Type of the item. One of TransactionValues.ItemType. | ||
* @param {string} type Type of the item. One of TransactionValues.LineItemType. | ||
* @return {LineItem} Returns current constructed LineItem. | ||
@@ -1156,4 +1370,4 @@ */ | ||
/** | ||
* UTC timestamp of the order update. | ||
* @type {Object} | ||
* UTC timestamp of the order update as an RFC 3339 string. | ||
* @type {String} | ||
*/ | ||
@@ -1235,3 +1449,3 @@ this.updateTime = undefined; | ||
* @param {number} seconds Seconds since Unix epoch. | ||
* @param {number=} nanos Partial time units. | ||
* @param {number=} nanos Partial time units. It is rounded to the nearest millisecond. | ||
* @return {OrderUpdate} Returns current constructed OrderUpdate. | ||
@@ -1244,3 +1458,9 @@ */ | ||
} | ||
this.updateTime = { seconds, nanos: nanos || 0 }; | ||
nanos = nanos || 0; // Default to 0 ns. | ||
// Convert time to date object, then RFC 3339 format. | ||
// Round nanoseconds to the nearest millisecond. 1M ns = 1ms. | ||
const MILLISECONDS_IN_SECOND = 1000; | ||
const NANOSECONDS_IN_MILLISECOND = 1000000; | ||
let dateObj = new Date((seconds * MILLISECONDS_IN_SECOND) + (nanos / NANOSECONDS_IN_MILLISECOND)); | ||
this.updateTime = dateObj.toISOString(); | ||
return this; | ||
@@ -1305,3 +1525,3 @@ } | ||
* | ||
* @param {string} type One of TransactionValues.OrderActions. | ||
* @param {string} type One of TransactionValues.ActionType. | ||
* @param {string} label Button label. | ||
@@ -1308,0 +1528,0 @@ * @param {string} url URL to open when button is clicked. |
Sorry, the diff of this file is too big to display
521122
22
15428
53
7