[nextgen/cardstack] lower default timeout to 3 minutes

This commit is contained in:
bignutty 2025-02-22 16:35:32 +01:00
parent e4c0934d8e
commit c969754ca8
3 changed files with 21 additions and 2 deletions

View file

@ -21,7 +21,7 @@ module.exports = {
try{
// This will create a new dynamic card stack
createDynamicCardStack(context, {
return createDynamicCardStack(context, {
cards: [
createEmbed("default", context, { description: "page 1"}),
createEmbed("default", context, { description: "page 2. this has a conditional button."})

View file

@ -1,6 +1,25 @@
const { DynamicCardStack } = require("./stack");
module.exports = {
/**
* Creates a new Dynamic Card Stack
*
* @param {Context} context Context
* @param {Object} options DynamicCardStack Arguments
* @param {Array<string>} options.buttons Card Stack built-in navigation buttons
* @param {Array} options.cards Root Card Stack
* @param {Object} options.interactive Interactive Components
* @param {Number} options.startingIndex Starting card index
* @param {boolean} options.loop Wrap paging
* @param {number} options.expires Timeout for the Card Stack listener.
* @param {boolean} options.disableStackCache Allows disabling the stack result cache, meaning that every trigger will reevaluate a stack
* @param {boolean} options.pageNumbers Renders Page Numbers in the footer of all embeds in cards.
* @param {Function} options.pageNumberGenerator Function that renders a page number. Default style is `Page <index>/<total>`
* @param {boolean} options.disableCloning Disables cloning a card stack when someone other than the author interacts with it.
* @param {boolean} options.ephemeral Makes the response ephemeral (primarily used by cloning)
*
* @returns {DynamicCardStack}
*/
createDynamicCardStack: (context, options)=>{
return new DynamicCardStack(context, options)
},

View file

@ -56,7 +56,7 @@ class DynamicCardStack {
this.interactive_components = options.interactive || {};
this.index = options.startingIndex || 0;
this.loopPages = options.loop || true;
this.expires = options.expires || 5 * 60 * 1000;
this.expires = options.expires || 3 * 60 * 1000;
this.pageNumbers = options.pageNumbers || true;
this.pageNumberGenerator = options.pageNumberGenerator || ((pg) => `Page ${pg.index + 1}/${pg.activeCardStack.length}`);
this.disableCloning = options.disableCloning || false;