@pendo/agent 2.310.0 → 2.311.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2771,13 +2771,18 @@ var ConfigReader = (function () {
2771
2771
  *
2772
2772
  * key - Actual config property name. Allows for disambiguation for the same property from different sources
2773
2773
  */
2774
- function addOption(name, sources = [PENDO_CONFIG_SRC], defaultValue, anySource) {
2774
+ function addOption(name, sources = [PENDO_CONFIG_SRC], defaultValue, anySource, aliases = []) {
2775
2775
  if (!name)
2776
2776
  return;
2777
2777
  if (optionMap[name])
2778
2778
  return;
2779
+ if (!_.isArray(aliases)) {
2780
+ // not using logging here to keep circular dependency issues clean
2781
+ aliases = [];
2782
+ }
2779
2783
  var opt = {
2780
2784
  name,
2785
+ aliases,
2781
2786
  defaultValue,
2782
2787
  supportedSources: sources
2783
2788
  };
@@ -2785,13 +2790,20 @@ var ConfigReader = (function () {
2785
2790
  opt.useAnySource = anySource;
2786
2791
  }
2787
2792
  optionMap[name] = opt;
2793
+ if (aliases.length > 0) {
2794
+ _.each(aliases, function (alias) {
2795
+ if (optionMap[alias] !== undefined)
2796
+ return;
2797
+ optionMap[alias] = opt;
2798
+ });
2799
+ }
2788
2800
  }
2789
2801
  function initializeOptions() {
2790
2802
  // Core
2791
2803
  /**
2792
2804
  * Formerly `additionalApiKeys`. When included, all analytics events will be sent to each of the public app IDs in the list (guide events are
2793
2805
  * only sent to the primary public app ID). This will only function if there are no `additionalPublicAppIds` set on
2794
- * the configuration included in the downloaded Agent.
2806
+ * the configuration included in the downloaded web SDK.
2795
2807
  *
2796
2808
  * @access public
2797
2809
  * @category Config/Core
@@ -2817,8 +2829,8 @@ var ConfigReader = (function () {
2817
2829
  */
2818
2830
  addOption('annotateUrl', [SNIPPET_SRC]);
2819
2831
  /**
2820
- * Formerly `apiKey`. A primary public app ID to send data to from the Agent. This will only function if there is no `publicAppId` set
2821
- * on the configuration included in the downloaded Agent.
2832
+ * Formerly `apiKey`. A primary public app ID to send data to from the web SDK. This will only function if there is no `publicAppId` set
2833
+ * on the configuration included in the downloaded web SDK.
2822
2834
  *
2823
2835
  * @access public
2824
2836
  * @category Config/Core
@@ -2830,7 +2842,7 @@ var ConfigReader = (function () {
2830
2842
  addOption('apiKey', [PENDO_CONFIG_SRC, SNIPPET_SRC]);
2831
2843
  addOption('assetHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2832
2844
  /**
2833
- * If set to `true`, the agent will try to install and initialize in all same-origin frames on the page.
2845
+ * If set to `true`, the web SDK will try to install and initialize in all same-origin frames on the page.
2834
2846
  * Read more about [frame support](/advanced/auto-frame-install).
2835
2847
  *
2836
2848
  * @access public
@@ -2854,7 +2866,7 @@ var ConfigReader = (function () {
2854
2866
  */
2855
2867
  addOption('contentHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2856
2868
  /**
2857
- * A unique domain to append to cookies that the Agent stores. If this is set, the Agent will not use local
2869
+ * A unique domain to append to cookies that the web SDK stores. If this is set, the web SDK will not use local
2858
2870
  * storage but will store all information as cookies using this domain. If not set, the browser will use
2859
2871
  * the current domain when setting cookies. **Note:** The domain must match the domain of the JavaScript
2860
2872
  * origin. Setting cookies to foreign domains will be silently ignored.
@@ -2880,7 +2892,7 @@ var ConfigReader = (function () {
2880
2892
  addOption('dataHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2881
2893
  addOption('disableAutoInitialize');
2882
2894
  /**
2883
- * Although the name refers to cookies, if set to `true` the Agent will not persist any data in local
2895
+ * Although the name refers to cookies, if set to `true` the web SDK will not persist any data in local
2884
2896
  * storage or cookies and will rely only on memory.
2885
2897
  *
2886
2898
  * @access public
@@ -2891,7 +2903,7 @@ var ConfigReader = (function () {
2891
2903
  */
2892
2904
  addOption('disableCookies', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2893
2905
  /**
2894
- * If set to `true` the Agent will cancel out of initialization. This can be useful to disable the Agent
2906
+ * If set to `true` the web SDK will cancel out of initialization. This can be useful to disable the web SDK
2895
2907
  * with minimal code changes.
2896
2908
  *
2897
2909
  * @access public
@@ -2902,9 +2914,9 @@ var ConfigReader = (function () {
2902
2914
  */
2903
2915
  addOption('disablePendo', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
2904
2916
  /**
2905
- * By default, the Agent will store the most recently used visitor and account ids as well as historical
2906
- * metadata. These stored values will be used if the agent is initialized in the future without them.
2907
- * Setting this to `true` will mean the agent will not store these values but will only use what is provided
2917
+ * By default, the web SDK will store the most recently used visitor and account ids as well as historical
2918
+ * metadata. These stored values will be used if the web SDK is initialized in the future without them.
2919
+ * Setting this to `true` will mean the web SDK will not store these values but will only use what is provided
2908
2920
  * or fall back to anonymous ids.
2909
2921
  *
2910
2922
  * @access public
@@ -2917,7 +2929,7 @@ var ConfigReader = (function () {
2917
2929
  addOption('enableSignedMetadata', [PENDO_CONFIG_SRC], false);
2918
2930
  /**
2919
2931
  * By default, the identity of a visitor in various iframes on a page are independent from each other.
2920
- * Setting this to `true` will instead have the Agent make sure all frames use the exact same visitor and
2932
+ * Setting this to `true` will instead have the web SDK make sure all frames use the exact same visitor and
2921
2933
  * account information. Read more about [frame support](/advanced/auto-frame-install).
2922
2934
  *
2923
2935
  * @access public
@@ -2942,7 +2954,7 @@ var ConfigReader = (function () {
2942
2954
  /**
2943
2955
  * Having identity persisted by default makes it so that a transition from using identified visitor ids
2944
2956
  * to using anonymous visitor ids is challenging. Anyone that used your application with an identified
2945
- * visitor id would have that value persisted to storage and whenever they agent is initialized for them,
2957
+ * visitor id would have that value persisted to storage and whenever the web SDK is initialized for them,
2946
2958
  * that value would be read from storage treating them as the same identified visitor. When set `true`,
2947
2959
  * this config option will only use persisted identity values if they are an anonymous id. It is meant to
2948
2960
  * be used to smoothly make this transition to using anonymous ids while still retaining the benefit of
@@ -2959,7 +2971,7 @@ var ConfigReader = (function () {
2959
2971
  addOption('identityStorageLifetime', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2960
2972
  addOption('identityStorageSuffix', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2961
2973
  /**
2962
- * If set to `true`, the Agent will strip url fragments from the url used for events (everything after a `#`
2974
+ * If set to `true`, the web SDK will strip url fragments from the url used for events (everything after a `#`
2963
2975
  * symbol). **Deprecated:** new usages to edit the url for events should use the
2964
2976
  * [location api](/advanced/location).
2965
2977
  *
@@ -2971,8 +2983,8 @@ var ConfigReader = (function () {
2971
2983
  */
2972
2984
  addOption('ignoreHashRouting', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2973
2985
  /**
2974
- * By default, the Agent will wait until the `document.readyState` is set to `"complete"`. Setting this to
2975
- * `true` will allow the Agent to initialize while the document is still loading.
2986
+ * By default, the web SDK will wait until the `document.readyState` is set to `"complete"`. Setting this to
2987
+ * `true` will allow the web SDK to initialize while the document is still loading.
2976
2988
  *
2977
2989
  * @access public
2978
2990
  * @category Config/Core
@@ -2983,7 +2995,7 @@ var ConfigReader = (function () {
2983
2995
  addOption('initializeImmediately', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
2984
2996
  addOption('installType');
2985
2997
  /**
2986
- * If set to `true`, the Agent will only persist data using local storage and memory.
2998
+ * If set to `true`, the web SDK will only persist data using local storage and memory.
2987
2999
  *
2988
3000
  * @access public
2989
3001
  * @category Config/Core
@@ -2993,7 +3005,7 @@ var ConfigReader = (function () {
2993
3005
  */
2994
3006
  addOption('localStorageOnly', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
2995
3007
  /**
2996
- * If set to `false`, the Agent will not use the `History.pushState` api to detect changes to the browser's
3008
+ * If set to `false`, the web SDK will not use the `History.pushState` api to detect changes to the browser's
2997
3009
  * URL. Instead a poll will be used. This can be necessary to disable for some SFDC applications.
2998
3010
  *
2999
3011
  * @access public
@@ -3006,8 +3018,8 @@ var ConfigReader = (function () {
3006
3018
  addOption('maxCookieTTLDays', [SNIPPET_SRC, PENDO_CONFIG_SRC], Infinity);
3007
3019
  /**
3008
3020
  * Use this setting when using `preferMutationObserver` with an application that has Shadow DOM elements.
3009
- * On page load, the Agent will run a full document scan for shadow roots and attach a MutationObserver to
3010
- * all results. This setting also allows the agent to run CSS selectors in all shadow roots, so CSS selectors
3021
+ * On page load, the web SDK will run a full document scan for shadow roots and attach a MutationObserver to
3022
+ * all results. This setting also allows the web SDK to run CSS selectors in all shadow roots, so CSS selectors
3011
3023
  * can be written without specifying the full path through all shadow roots with the `::shadow` pseudo-class.
3012
3024
  *
3013
3025
  * @access public
@@ -3020,8 +3032,8 @@ var ConfigReader = (function () {
3020
3032
  addOption('pendoCore', [PENDO_CONFIG_SRC], true);
3021
3033
  addOption('pendoGlobalKey', [PENDO_CONFIG_SRC]);
3022
3034
  /**
3023
- * By default, if there are multiple frames on the page that have the Agent installed, they will communicate
3024
- * using `window.postMessage`. If set to `true` the Agent will instead use the browser's Broadcast Channel
3035
+ * By default, if there are multiple frames on the page that have the web SDK installed, they will communicate
3036
+ * using `window.postMessage`. If set to `true` the web SDK will instead use the browser's Broadcast Channel
3025
3037
  * API to communicate. This will only work when all frames use the same domain.
3026
3038
  *
3027
3039
  * @access public
@@ -3032,8 +3044,8 @@ var ConfigReader = (function () {
3032
3044
  */
3033
3045
  addOption('preferBroadcastChannel', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3034
3046
  /**
3035
- * By default, the Agent will scan the page every 500ms to determine if any new badges or guides are eligible.
3036
- * To improve idle performance, this can be set to `true` and then the Agent will instead use a mutation
3047
+ * By default, the web SDK will scan the page every 500ms to determine if any new badges or guides are eligible.
3048
+ * To improve idle performance, this can be set to `true` and then the web SDK will instead use a mutation
3037
3049
  * observer and only check eligibility if the page content has changed.
3038
3050
  *
3039
3051
  * @access public
@@ -3045,8 +3057,8 @@ var ConfigReader = (function () {
3045
3057
  addOption('preferMutationObserver', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3046
3058
  addOption('preventCookieRefresh');
3047
3059
  /**
3048
- * By default, the Agent adds an `unload` event listener to the page to make sure it sends events upon
3049
- * navigation. If set to `true`, the Agent will instead use the `visibilitychange` event listener and send
3060
+ * By default, the web SDK adds an `unload` event listener to the page to make sure it sends events upon
3061
+ * navigation. If set to `true`, the web SDK will instead use the `visibilitychange` event listener and send
3050
3062
  * events when the visibility is changing to `"hidden"`.
3051
3063
  *
3052
3064
  * @access public
@@ -3058,7 +3070,7 @@ var ConfigReader = (function () {
3058
3070
  addOption('preventUnloadListener', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3059
3071
  addOption('promotedAgentMetadataConfigurations', [PENDO_CONFIG_SRC]);
3060
3072
  /**
3061
- * An array of strings or a function that returns an array of strings. The Agent will then strip any query
3073
+ * An array of strings or a function that returns an array of strings. The web SDK will then strip any query
3062
3074
  * string parameters from the url that are not found in the provided array. **Deprecated:** new usages to
3063
3075
  * edit the url for events should use the [location api](/advanced/location).
3064
3076
  *
@@ -3084,7 +3096,7 @@ var ConfigReader = (function () {
3084
3096
  addOption('sanitizeUrl', [SNIPPET_SRC]);
3085
3097
  addOption('selfHosted');
3086
3098
  /**
3087
- * Meant to be used with `autoFrameInstall`. If set, the Agent will use this as the url to download the Agent
3099
+ * Meant to be used with `autoFrameInstall`. If set, the web SDK will use this as the url to download itself
3088
3100
  * from in child frames. Read more about [frame support](/advanced/auto-frame-install).
3089
3101
  *
3090
3102
  * @access public
@@ -3111,7 +3123,7 @@ var ConfigReader = (function () {
3111
3123
  // Analytics
3112
3124
  /**
3113
3125
  * An array of exact strings that can still be included in event data if text capture is disabled
3114
- * (`excludeAllText`). This will override any allow list that is stored for your application settings.
3126
+ * (`excludeAllText`). This will not override any allow list specified by your application settings but will apply if none is provided.
3115
3127
  * These are not selectors but are equality checks (the string 'Bug' will allow links that have 'Bug' as the
3116
3128
  * text to be captured but not ones like 'Bug Report')
3117
3129
  *
@@ -3121,9 +3133,9 @@ var ConfigReader = (function () {
3121
3133
  * @default []
3122
3134
  * @type {string[]}
3123
3135
  */
3124
- addOption('allowedText', [SNIPPET_SRC, PENDO_CONFIG_SRC], []);
3136
+ addOption('allowedText', [PENDO_CONFIG_SRC, SNIPPET_SRC], [], true);
3125
3137
  /**
3126
- * An array of specific Pendo events that you do not want the Agent to capture. Available event types
3138
+ * An array of specific Pendo events that you do not want the web SDK to capture. Available event types
3127
3139
  * include: `identify`, `meta`, `load`, `click`, `focus`, `submit`, `change`, `track`. See [Event Controls](/events/event-controls)
3128
3140
  * for more information.
3129
3141
  *
@@ -3145,7 +3157,7 @@ var ConfigReader = (function () {
3145
3157
  */
3146
3158
  addOption('analytics.localStorageUnload', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3147
3159
  /**
3148
- * If set to `true`, the Agent will log out when various events internal to the Agent occur.
3160
+ * If set to `true`, the web SDK will log when various internal events occur.
3149
3161
  *
3150
3162
  * @access public
3151
3163
  * @category Config/Analytics
@@ -3169,7 +3181,7 @@ var ConfigReader = (function () {
3169
3181
  */
3170
3182
  addOption('eventPropertyMatchParents', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
3171
3183
  /**
3172
- * By default, the Agent will include text from elements while capturing events. Setting this to `true` will
3184
+ * By default, the web SDK will include text from elements while capturing events. Setting this to `true` will
3173
3185
  * instead prevent the text from being included unless it matches the `allowedText` list. If the subscription
3174
3186
  * flag to disable text capture is turned on, this option cannot be used to reenable it.
3175
3187
  *
@@ -3181,7 +3193,7 @@ var ConfigReader = (function () {
3181
3193
  */
3182
3194
  addOption('excludeAllText', [PENDO_CONFIG_SRC, SNIPPET_SRC], false, true);
3183
3195
  /**
3184
- * When `true`, the Agent will only send guide and poll events. All other events will not be sent, including:
3196
+ * When `true`, the web SDK will only send guide and poll events. All other events will not be sent, including:
3185
3197
  * identify, meta, load, click, focus, change, submit, or track. Metadata assigned to visitors will still function
3186
3198
  * for guide targeting but will not be sent to Pendo to be visible in the UI. See [Event Controls](/events/event-controls)
3187
3199
  * for more information.
@@ -3197,7 +3209,7 @@ var ConfigReader = (function () {
3197
3209
  addOption('htmlAttributes');
3198
3210
  addOption('interceptElementRemoval', [SNIPPET_SRC, PENDO_CONFIG_SRC], false); // old, use syntheticClicks.elementRemoval instead
3199
3211
  /**
3200
- * By default, the agent will attempt to intercept calls to `preventDefault` on `touchend` events in order to
3212
+ * By default, the web SDK will attempt to intercept calls to `preventDefault` on `touchend` events in order to
3201
3213
  * ensure that Pendo still tracks the click event. There are cases where your application might prevent these
3202
3214
  * original clicks in order to synthesize your own click event, in that case and where you might be seeing
3203
3215
  * duplicate clicks because of it, this functionality can be disabled.
@@ -3210,7 +3222,7 @@ var ConfigReader = (function () {
3210
3222
  */
3211
3223
  addOption('interceptPreventDefault', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
3212
3224
  /**
3213
- * By default, the agent will also attempt to intercept calls to `stopPropagation` and
3225
+ * By default, the web SDK will also attempt to intercept calls to `stopPropagation` and
3214
3226
  * `stopImmediatePropagation` for click, focus, submit, and change events in order to ensure that Pendo can
3215
3227
  * still probably recognize these events. In the case of this causing duplicate events or other issues, this
3216
3228
  * functionality can be disabled.
@@ -3225,7 +3237,7 @@ var ConfigReader = (function () {
3225
3237
  /**
3226
3238
  * Sometimes an application removes an event that is clicked on between the `mousedown` and `mouseup` browser
3227
3239
  * events. In these cases, Pendo will not be able to capture the `click` event properly for events or guide
3228
- * behavior. Setting this to `true` will have the Agent intercept these types of element removal to ensure
3240
+ * behavior. Setting this to `true` will have the web SDK intercept these types of element removal to ensure
3229
3241
  * more consistent Pendo behavior (this option has been moved from `interceptElementRemoval`).
3230
3242
  *
3231
3243
  * @access public
@@ -3285,7 +3297,7 @@ var ConfigReader = (function () {
3285
3297
  addOption('cacheGuidesTimeout', [PENDO_CONFIG_SRC], 600000);
3286
3298
  addOption('delayGuides', [SNIPPET_SRC]); // old, use guides.delay instead
3287
3299
  /**
3288
- * If `true`, this will prevent the agent from attempting to launch the Visual Design Studio.
3300
+ * If `true`, this will prevent the web SDK from attempting to launch the Visual Design Studio.
3289
3301
  *
3290
3302
  * @access public
3291
3303
  * @category Config/Guides
@@ -3296,7 +3308,7 @@ var ConfigReader = (function () {
3296
3308
  addOption('disableDesigner', [PENDO_CONFIG_SRC, SNIPPET_SRC], false);
3297
3309
  addOption('disableDesignerKeyboardShortcut', [PENDO_CONFIG_SRC], false);
3298
3310
  /**
3299
- * If `true`, this will prevent the agent from downloading your application's
3311
+ * If `true`, this will prevent the web SDK from downloading your application's
3300
3312
  * [global css](https://support.pendo.io/hc/en-us/articles/360032206511-Guide-Styling-Classic-#global-css-0-2)
3301
3313
  * file as well as the default classic guide css.
3302
3314
  *
@@ -3332,7 +3344,7 @@ var ConfigReader = (function () {
3332
3344
  */
3333
3345
  addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
3334
3346
  /**
3335
- * If `true`, the agent will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
3347
+ * If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
3336
3348
  * keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
3337
3349
  *
3338
3350
  * @access public
@@ -3452,8 +3464,8 @@ var ConfigReader = (function () {
3452
3464
  */
3453
3465
  addOption('guides.tooltip.arrowSize', [SNIPPET_SRC]);
3454
3466
  /**
3455
- * If set, the agent will attach the provided value as a [nonce](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#nonces)
3456
- * onto all inline stylesheets the agent adds. This is used to remove the need for "unsafe-inline" on the "style-src" of your
3467
+ * If set, the web SDK will attach the provided value as a [nonce](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#nonces)
3468
+ * onto all inline stylesheets the web SDK adds. This is used to remove the need for "unsafe-inline" on the "style-src" of your
3457
3469
  * CSP and will support live guides as well as Visual Design Studio users.
3458
3470
  *
3459
3471
  * @access public
@@ -3507,7 +3519,7 @@ var ConfigReader = (function () {
3507
3519
  addOption('feedbackSettings', [PENDO_CONFIG_SRC], {});
3508
3520
  addOption('pendoFeedback', [PENDO_CONFIG_SRC], false);
3509
3521
  /**
3510
- * If set, the Agent will use this as the suffix when writing last step advanced key into the visitors cookie.
3522
+ * If set, the web SDK will use this as the suffix when writing last step advanced key into the visitors cookie.
3511
3523
  * This supports cross app guides by having a shared accessible location for different apps on the same effective level domain.
3512
3524
  *
3513
3525
  * @access public
@@ -3518,7 +3530,7 @@ var ConfigReader = (function () {
3518
3530
  */
3519
3531
  addOption('crossAppGuideStorageSuffix', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
3520
3532
  /**
3521
- * If `true`, the Agent will launch a version of the Designer that is compatible with the
3533
+ * If `true`, the web SDK will launch a version of the Designer that is compatible with the
3522
3534
  * `Cross-Origin-Embedder-Policy: require-corp` header.
3523
3535
  *
3524
3536
  * @access public
@@ -3904,7 +3916,7 @@ var buildArrowDimensionsQM = function (dim, elementPos) {
3904
3916
  // Environment values are typically injected by gulp
3905
3917
  // If in module mode, all injected values will be empty.
3906
3918
  // In that case, we'll overwrite them on initAgent via overwriteBuiltConfigWithPendoConfig
3907
- /* eslint-disable agent-eslint-rules/no-gulp-env-references */
3919
+ /* eslint-disable web-sdk-eslint-rules/no-gulp-env-references */
3908
3920
  let ENV = '';
3909
3921
  let GLOBAL_BUCKET = '';
3910
3922
  let SUBSCRIPTION_BUCKET = '';
@@ -3912,10 +3924,10 @@ let SERVER = '';
3912
3924
  let ASSET_HOST = '';
3913
3925
  let ASSET_PATH = '';
3914
3926
  let DESIGNER_SERVER = '';
3915
- let VERSION = '2.310.0_';
3916
- let PACKAGE_VERSION = '2.310.0';
3927
+ let VERSION = '2.311.0_';
3928
+ let PACKAGE_VERSION = '2.311.0';
3917
3929
  let LOADER = 'xhr';
3918
- /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3930
+ /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3919
3931
  /**
3920
3932
  * Returns current version of the Pendo Web SDK as a string. Also directly accessible at `pendo.VERSION`.
3921
3933
  *
@@ -6205,7 +6217,7 @@ var shadowAPI = (function () {
6205
6217
  if (!isShadowSelector(selection)) {
6206
6218
  const queryResults = Sizzle(selection, context, results, seed);
6207
6219
  if (shadowDomManager.cache.size > 0) {
6208
- // eslint-disable-next-line agent-eslint-rules/no-array-foreach
6220
+ // eslint-disable-next-line web-sdk-eslint-rules/no-array-foreach
6209
6221
  shadowDomManager.cache.forEach(shadowRoot => {
6210
6222
  if (!context || context === document || contains(context, shadowRoot)) {
6211
6223
  queryResults.push(...Sizzle(selection, shadowRoot, results, seed));
@@ -11605,7 +11617,7 @@ function isTrustedOrigin(host) {
11605
11617
  /^https:\/\/([a-zA-Z0-9-]+-dot-)?pendo-(apollo|armada|atlas|batman|calypso|dap|dev|dr-us-east1|eu-dev|freeze|helix|link|magic|mcfly|ml|mobile-fbi|mobile-guides|mobile-hummus|mobile-plat|perfserf|voc|wildlings|ionchef|scrum-ops|security|test|uat|au|eu|govramp|hsbc|io|jp-prod|us1)\.appspot\.com$/,
11606
11618
  /^https:\/\/(via|adopt|local)\.pendo\.(local|io):\d{4}$/,
11607
11619
  /^https:\/\/pendo-(apollo|armada|atlas|batman|calypso|dap|dev|dr-us-east1|eu-dev|freeze|helix|link|magic|mcfly|ml|mobile-fbi|mobile-guides|mobile-hummus|mobile-plat|perfserf|voc|wildlings|ionchef|scrum-ops|security|test|uat)-static\.storage\.googleapis\.com$/
11608
- ]; // eslint-disable-line agent-eslint-rules/no-gulp-env-references
11620
+ ]; // eslint-disable-line web-sdk-eslint-rules/no-gulp-env-references
11609
11621
  var adoptHost = ConfigReader.get('adoptHost');
11610
11622
  if (adoptHost) {
11611
11623
  var fullHostname = 'https://' + adoptHost;
@@ -12579,12 +12591,12 @@ class PerformanceMonitor {
12579
12591
  }
12580
12592
  }
12581
12593
  _clearMarksAndMeasures() {
12582
- // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12594
+ // eslint-disable-next-line web-sdk-eslint-rules/no-array-foreach
12583
12595
  this.marks.forEach(name => {
12584
12596
  performance.clearMarks(name);
12585
12597
  });
12586
12598
  this.marks.clear();
12587
- // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12599
+ // eslint-disable-next-line web-sdk-eslint-rules/no-array-foreach
12588
12600
  this.measures.forEach(name => {
12589
12601
  performance.clearMeasures(name);
12590
12602
  });
@@ -14300,6 +14312,9 @@ var findBadgeForStep = function (step) {
14300
14312
  return badgeElement;
14301
14313
  };
14302
14314
  /*
14315
+ * TODO: refactor this.
14316
+ * override is really only used for steps with badges.
14317
+ *
14303
14318
  * need a way to check: is original element visible.
14304
14319
  * if so, rendering is a go.
14305
14320
  * then
@@ -14311,19 +14326,15 @@ var getElementForGuideStep = function (step, doc) {
14311
14326
  log.info('Can\'t get element for null step');
14312
14327
  return null;
14313
14328
  }
14314
- const guide = step.getGuide();
14315
- const isBuildingBlockGuide = _.get(guide, 'attributes.type') === 'building-block';
14316
- const canSetOverrideElement = isBuildingBlockGuide || !isWalkthrough(guide);
14317
- let badge = step.overrideElement;
14318
- const isFirstStep = _.get(guide, 'steps.0.id') === step.id;
14319
- if (!badge && canSetOverrideElement) {
14320
- badge = findBadgeForStep(step);
14321
- step.overrideElement = badge;
14329
+ var guide = step.getGuide();
14330
+ var isBuildingBlockGuide = _.get(guide, 'attributes.type') === 'building-block';
14331
+ var canSetOverrideElement = isBuildingBlockGuide || !isWalkthrough(guide);
14332
+ if (!step.overrideElement && canSetOverrideElement) {
14333
+ step.overrideElement = findBadgeForStep(step);
14322
14334
  }
14323
14335
  step.targetElement = getElementForTargeting(step, doc);
14324
- const targetToBadge = badge || (isBadge(guide) && isFirstStep);
14325
- if (targetToBadge) {
14326
- return badge;
14336
+ if (step.overrideElement) {
14337
+ return step.overrideElement;
14327
14338
  }
14328
14339
  return step.targetElement;
14329
14340
  };
@@ -28379,7 +28390,7 @@ class ShadowDomManager extends EventTarget {
28379
28390
  this.stoppedSearchEarly = false;
28380
28391
  }
28381
28392
  updateCache() {
28382
- // eslint-disable-next-line agent-eslint-rules/no-array-foreach
28393
+ // eslint-disable-next-line web-sdk-eslint-rules/no-array-foreach
28383
28394
  this.cache.forEach(shadowRoot => {
28384
28395
  if (!isInDocument(shadowRoot)) {
28385
28396
  this.cache.delete(shadowRoot);
@@ -33080,6 +33091,9 @@ var FramesModule = (function () {
33080
33091
  return tryShowInNextFrame();
33081
33092
  },
33082
33093
  requestShowGuideStepInFrame(context, payload) {
33094
+ if (!context.state.frames[payload.frameId]) {
33095
+ return q.reject({ error: 'Frame not found' });
33096
+ }
33083
33097
  var requestId = payload.frameId + '/' + randomString(32);
33084
33098
  var deferred = q.defer();
33085
33099
  requests[requestId] = deferred;
@@ -38551,7 +38565,8 @@ const EmbeddedGuides = (function () {
38551
38565
  let globalPendo;
38552
38566
  let _;
38553
38567
  const embeddedGuides = [];
38554
- let _oldEmbeddedGuides = [];
38568
+ let embeddedGuidesCache = [];
38569
+ let embeddedGuidesCacheValid = false;
38555
38570
  return {
38556
38571
  name: 'EmbeddedGuides',
38557
38572
  activeEmbeddedGuides: embeddedGuides,
@@ -38568,6 +38583,8 @@ const EmbeddedGuides = (function () {
38568
38583
  pluginApi.Events.on('guideListChanged', initializeEmbeddedGuides);
38569
38584
  pluginApi.Events.on('urlChanged', setForceShowFirstStepFlags);
38570
38585
  pluginApi.Events.on('guideAdvanced', hideGuide);
38586
+ pluginApi.Events.on('metadata', onMetadataChange);
38587
+ pluginApi.Events.on('identify', onIdentify);
38571
38588
  pluginApi.GuideLoop.addUpdatePhase(processEmbeddedGuides);
38572
38589
  pluginApi.guides.addProcessor(extractEmbeddedGuides);
38573
38590
  pluginApi.GuideActivity.registerGuideResolver(getGuideObjectFromEvent);
@@ -38575,17 +38592,19 @@ const EmbeddedGuides = (function () {
38575
38592
  }
38576
38593
  function teardown() {
38577
38594
  clearEmbeddedGuides();
38595
+ clearEmbeddedGuidesCache();
38578
38596
  pluginApi.Events.off('deliverablesLoaded', clearEmbeddedGuides);
38579
38597
  pluginApi.Events.off('guideLoopStopped', onGuidesStopped);
38580
38598
  pluginApi.Events.off('guideListChanged', initializeEmbeddedGuides);
38581
38599
  pluginApi.Events.off('urlChanged', setForceShowFirstStepFlags);
38582
38600
  pluginApi.Events.off('guideAdvanced', hideGuide);
38601
+ pluginApi.Events.off('metadata', onMetadataChange);
38602
+ pluginApi.Events.off('identify', onIdentify);
38583
38603
  pluginApi.GuideLoop.removeUpdatePhase(processEmbeddedGuides);
38584
38604
  pluginApi.guides.removeProcessor(extractEmbeddedGuides);
38585
38605
  pluginApi.GuideActivity.removeGuideResolver(getGuideObjectFromEvent);
38586
38606
  if (this.removeResizeEvent)
38587
38607
  this.removeResizeEvent();
38588
- _oldEmbeddedGuides.length = 0;
38589
38608
  }
38590
38609
  function onGuidesStopped() {
38591
38610
  // The guideLoopStopped event sometimes is sent when the guide loop is restarted, for example when a guide is advanced.
@@ -38624,10 +38643,24 @@ const EmbeddedGuides = (function () {
38624
38643
  });
38625
38644
  }
38626
38645
  function clearEmbeddedGuides() {
38627
- _oldEmbeddedGuides = _.toArray(embeddedGuides);
38628
38646
  pluginApi.guides.removeDisplayableGuides('embeddedGuides');
38629
38647
  embeddedGuides.length = 0;
38630
38648
  }
38649
+ function clearEmbeddedGuidesCache() {
38650
+ embeddedGuidesCache.length = 0;
38651
+ }
38652
+ function setEmbeddedGuideCacheValid(value) {
38653
+ embeddedGuidesCacheValid = value;
38654
+ }
38655
+ function onMetadataChange(event) {
38656
+ const { storeChanged } = event.data[0];
38657
+ if (storeChanged) {
38658
+ setEmbeddedGuideCacheValid(false);
38659
+ }
38660
+ }
38661
+ function onIdentify() {
38662
+ setEmbeddedGuideCacheValid(false);
38663
+ }
38631
38664
  // This function syncs the forceShowFirstStep with the restartOnReload property on guides
38632
38665
  // This function is run on the urlChanged event.
38633
38666
  function setForceShowFirstStepFlags() {
@@ -38694,6 +38727,8 @@ const EmbeddedGuides = (function () {
38694
38727
  restoreFromPreviousGuides();
38695
38728
  pluginApi.guides.registerDisplayableGuides('embeddedGuides', embeddedGuides);
38696
38729
  applyEmbeddedGuideBehaviors();
38730
+ embeddedGuidesCache = _.toArray(embeddedGuides);
38731
+ setEmbeddedGuideCacheValid(true);
38697
38732
  }
38698
38733
  function applyEmbeddedGuideBehaviors() {
38699
38734
  _.map(embeddedGuides, function (guide) {
@@ -38703,22 +38738,21 @@ const EmbeddedGuides = (function () {
38703
38738
  });
38704
38739
  });
38705
38740
  }
38706
- // When a guides payload is received, the embedded guides list is cleared and cached in _oldEmbeddedGuides.
38741
+ // When a guides payload is received, the embedded guides list is cleared and cached in embeddedGuidesCache.
38707
38742
  // This function replaces guides in the new payload with guides from the previous payload to prevent re-rendering.
38708
38743
  // Additionally, if guides from the previous payload are showing, and they are not in the new payload, this function hides them.
38709
38744
  function restoreFromPreviousGuides() {
38710
- _.each(_oldEmbeddedGuides, function (oldGuide) {
38745
+ _.each(embeddedGuidesCache, function (oldGuide) {
38711
38746
  const newGuideIndex = _.findIndex(embeddedGuides, function (guide) {
38712
38747
  return guide.id === oldGuide.id;
38713
38748
  });
38714
- if (newGuideIndex === -1 && oldGuide.isShownInThisFrame()) {
38749
+ if (!embeddedGuidesCacheValid || newGuideIndex === -1) {
38715
38750
  oldGuide.hide();
38716
38751
  }
38717
38752
  else if (!oldGuide.isFrameProxy) {
38718
38753
  embeddedGuides[newGuideIndex] = oldGuide;
38719
38754
  }
38720
38755
  });
38721
- _oldEmbeddedGuides.length = 0;
38722
38756
  }
38723
38757
  function exportPublicEmbeddedGuideApi(pendo) {
38724
38758
  pendo.getEmbeddedGuides = getEmbeddedGuides;
@@ -48574,6 +48608,18 @@ class SendQueue {
48574
48608
  }
48575
48609
  }
48576
48610
 
48611
+ function __rest(s, e) {
48612
+ var t = {};
48613
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48614
+ t[p] = s[p];
48615
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
48616
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
48617
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
48618
+ t[p[i]] = s[p[i]];
48619
+ }
48620
+ return t;
48621
+ }
48622
+
48577
48623
  function __awaiter(thisArg, _arguments, P, generator) {
48578
48624
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48579
48625
  return new (P || (P = Promise$2))(function (resolve, reject) {
@@ -56215,13 +56261,18 @@ var ConfigReader = (function () {
56215
56261
  *
56216
56262
  * key - Actual config property name. Allows for disambiguation for the same property from different sources
56217
56263
  */
56218
- function addOption(name, sources = [PENDO_CONFIG_SRC], defaultValue, anySource) {
56264
+ function addOption(name, sources = [PENDO_CONFIG_SRC], defaultValue, anySource, aliases = []) {
56219
56265
  if (!name)
56220
56266
  return;
56221
56267
  if (optionMap[name])
56222
56268
  return;
56269
+ if (!_.isArray(aliases)) {
56270
+ // not using logging here to keep circular dependency issues clean
56271
+ aliases = [];
56272
+ }
56223
56273
  var opt = {
56224
56274
  name,
56275
+ aliases,
56225
56276
  defaultValue,
56226
56277
  supportedSources: sources
56227
56278
  };
@@ -56229,13 +56280,20 @@ var ConfigReader = (function () {
56229
56280
  opt.useAnySource = anySource;
56230
56281
  }
56231
56282
  optionMap[name] = opt;
56283
+ if (aliases.length > 0) {
56284
+ _.each(aliases, function (alias) {
56285
+ if (optionMap[alias] !== undefined)
56286
+ return;
56287
+ optionMap[alias] = opt;
56288
+ });
56289
+ }
56232
56290
  }
56233
56291
  function initializeOptions() {
56234
56292
  // Core
56235
56293
  /**
56236
56294
  * Formerly `additionalApiKeys`. When included, all analytics events will be sent to each of the public app IDs in the list (guide events are
56237
56295
  * only sent to the primary public app ID). This will only function if there are no `additionalPublicAppIds` set on
56238
- * the configuration included in the downloaded Agent.
56296
+ * the configuration included in the downloaded web SDK.
56239
56297
  *
56240
56298
  * @access public
56241
56299
  * @category Config/Core
@@ -56261,8 +56319,8 @@ var ConfigReader = (function () {
56261
56319
  */
56262
56320
  addOption('annotateUrl', [SNIPPET_SRC]);
56263
56321
  /**
56264
- * Formerly `apiKey`. A primary public app ID to send data to from the Agent. This will only function if there is no `publicAppId` set
56265
- * on the configuration included in the downloaded Agent.
56322
+ * Formerly `apiKey`. A primary public app ID to send data to from the web SDK. This will only function if there is no `publicAppId` set
56323
+ * on the configuration included in the downloaded web SDK.
56266
56324
  *
56267
56325
  * @access public
56268
56326
  * @category Config/Core
@@ -56274,7 +56332,7 @@ var ConfigReader = (function () {
56274
56332
  addOption('apiKey', [PENDO_CONFIG_SRC, SNIPPET_SRC]);
56275
56333
  addOption('assetHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56276
56334
  /**
56277
- * If set to `true`, the agent will try to install and initialize in all same-origin frames on the page.
56335
+ * If set to `true`, the web SDK will try to install and initialize in all same-origin frames on the page.
56278
56336
  * Read more about [frame support](/advanced/auto-frame-install).
56279
56337
  *
56280
56338
  * @access public
@@ -56298,7 +56356,7 @@ var ConfigReader = (function () {
56298
56356
  */
56299
56357
  addOption('contentHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56300
56358
  /**
56301
- * A unique domain to append to cookies that the Agent stores. If this is set, the Agent will not use local
56359
+ * A unique domain to append to cookies that the web SDK stores. If this is set, the web SDK will not use local
56302
56360
  * storage but will store all information as cookies using this domain. If not set, the browser will use
56303
56361
  * the current domain when setting cookies. **Note:** The domain must match the domain of the JavaScript
56304
56362
  * origin. Setting cookies to foreign domains will be silently ignored.
@@ -56324,7 +56382,7 @@ var ConfigReader = (function () {
56324
56382
  addOption('dataHost', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56325
56383
  addOption('disableAutoInitialize');
56326
56384
  /**
56327
- * Although the name refers to cookies, if set to `true` the Agent will not persist any data in local
56385
+ * Although the name refers to cookies, if set to `true` the web SDK will not persist any data in local
56328
56386
  * storage or cookies and will rely only on memory.
56329
56387
  *
56330
56388
  * @access public
@@ -56335,7 +56393,7 @@ var ConfigReader = (function () {
56335
56393
  */
56336
56394
  addOption('disableCookies', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56337
56395
  /**
56338
- * If set to `true` the Agent will cancel out of initialization. This can be useful to disable the Agent
56396
+ * If set to `true` the web SDK will cancel out of initialization. This can be useful to disable the web SDK
56339
56397
  * with minimal code changes.
56340
56398
  *
56341
56399
  * @access public
@@ -56346,9 +56404,9 @@ var ConfigReader = (function () {
56346
56404
  */
56347
56405
  addOption('disablePendo', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56348
56406
  /**
56349
- * By default, the Agent will store the most recently used visitor and account ids as well as historical
56350
- * metadata. These stored values will be used if the agent is initialized in the future without them.
56351
- * Setting this to `true` will mean the agent will not store these values but will only use what is provided
56407
+ * By default, the web SDK will store the most recently used visitor and account ids as well as historical
56408
+ * metadata. These stored values will be used if the web SDK is initialized in the future without them.
56409
+ * Setting this to `true` will mean the web SDK will not store these values but will only use what is provided
56352
56410
  * or fall back to anonymous ids.
56353
56411
  *
56354
56412
  * @access public
@@ -56361,7 +56419,7 @@ var ConfigReader = (function () {
56361
56419
  addOption('enableSignedMetadata', [PENDO_CONFIG_SRC], false);
56362
56420
  /**
56363
56421
  * By default, the identity of a visitor in various iframes on a page are independent from each other.
56364
- * Setting this to `true` will instead have the Agent make sure all frames use the exact same visitor and
56422
+ * Setting this to `true` will instead have the web SDK make sure all frames use the exact same visitor and
56365
56423
  * account information. Read more about [frame support](/advanced/auto-frame-install).
56366
56424
  *
56367
56425
  * @access public
@@ -56386,7 +56444,7 @@ var ConfigReader = (function () {
56386
56444
  /**
56387
56445
  * Having identity persisted by default makes it so that a transition from using identified visitor ids
56388
56446
  * to using anonymous visitor ids is challenging. Anyone that used your application with an identified
56389
- * visitor id would have that value persisted to storage and whenever they agent is initialized for them,
56447
+ * visitor id would have that value persisted to storage and whenever the web SDK is initialized for them,
56390
56448
  * that value would be read from storage treating them as the same identified visitor. When set `true`,
56391
56449
  * this config option will only use persisted identity values if they are an anonymous id. It is meant to
56392
56450
  * be used to smoothly make this transition to using anonymous ids while still retaining the benefit of
@@ -56403,7 +56461,7 @@ var ConfigReader = (function () {
56403
56461
  addOption('identityStorageLifetime', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56404
56462
  addOption('identityStorageSuffix', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56405
56463
  /**
56406
- * If set to `true`, the Agent will strip url fragments from the url used for events (everything after a `#`
56464
+ * If set to `true`, the web SDK will strip url fragments from the url used for events (everything after a `#`
56407
56465
  * symbol). **Deprecated:** new usages to edit the url for events should use the
56408
56466
  * [location api](/advanced/location).
56409
56467
  *
@@ -56415,8 +56473,8 @@ var ConfigReader = (function () {
56415
56473
  */
56416
56474
  addOption('ignoreHashRouting', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56417
56475
  /**
56418
- * By default, the Agent will wait until the `document.readyState` is set to `"complete"`. Setting this to
56419
- * `true` will allow the Agent to initialize while the document is still loading.
56476
+ * By default, the web SDK will wait until the `document.readyState` is set to `"complete"`. Setting this to
56477
+ * `true` will allow the web SDK to initialize while the document is still loading.
56420
56478
  *
56421
56479
  * @access public
56422
56480
  * @category Config/Core
@@ -56427,7 +56485,7 @@ var ConfigReader = (function () {
56427
56485
  addOption('initializeImmediately', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56428
56486
  addOption('installType');
56429
56487
  /**
56430
- * If set to `true`, the Agent will only persist data using local storage and memory.
56488
+ * If set to `true`, the web SDK will only persist data using local storage and memory.
56431
56489
  *
56432
56490
  * @access public
56433
56491
  * @category Config/Core
@@ -56437,7 +56495,7 @@ var ConfigReader = (function () {
56437
56495
  */
56438
56496
  addOption('localStorageOnly', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56439
56497
  /**
56440
- * If set to `false`, the Agent will not use the `History.pushState` api to detect changes to the browser's
56498
+ * If set to `false`, the web SDK will not use the `History.pushState` api to detect changes to the browser's
56441
56499
  * URL. Instead a poll will be used. This can be necessary to disable for some SFDC applications.
56442
56500
  *
56443
56501
  * @access public
@@ -56450,8 +56508,8 @@ var ConfigReader = (function () {
56450
56508
  addOption('maxCookieTTLDays', [SNIPPET_SRC, PENDO_CONFIG_SRC], Infinity);
56451
56509
  /**
56452
56510
  * Use this setting when using `preferMutationObserver` with an application that has Shadow DOM elements.
56453
- * On page load, the Agent will run a full document scan for shadow roots and attach a MutationObserver to
56454
- * all results. This setting also allows the agent to run CSS selectors in all shadow roots, so CSS selectors
56511
+ * On page load, the web SDK will run a full document scan for shadow roots and attach a MutationObserver to
56512
+ * all results. This setting also allows the web SDK to run CSS selectors in all shadow roots, so CSS selectors
56455
56513
  * can be written without specifying the full path through all shadow roots with the `::shadow` pseudo-class.
56456
56514
  *
56457
56515
  * @access public
@@ -56464,8 +56522,8 @@ var ConfigReader = (function () {
56464
56522
  addOption('pendoCore', [PENDO_CONFIG_SRC], true);
56465
56523
  addOption('pendoGlobalKey', [PENDO_CONFIG_SRC]);
56466
56524
  /**
56467
- * By default, if there are multiple frames on the page that have the Agent installed, they will communicate
56468
- * using `window.postMessage`. If set to `true` the Agent will instead use the browser's Broadcast Channel
56525
+ * By default, if there are multiple frames on the page that have the web SDK installed, they will communicate
56526
+ * using `window.postMessage`. If set to `true` the web SDK will instead use the browser's Broadcast Channel
56469
56527
  * API to communicate. This will only work when all frames use the same domain.
56470
56528
  *
56471
56529
  * @access public
@@ -56476,8 +56534,8 @@ var ConfigReader = (function () {
56476
56534
  */
56477
56535
  addOption('preferBroadcastChannel', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56478
56536
  /**
56479
- * By default, the Agent will scan the page every 500ms to determine if any new badges or guides are eligible.
56480
- * To improve idle performance, this can be set to `true` and then the Agent will instead use a mutation
56537
+ * By default, the web SDK will scan the page every 500ms to determine if any new badges or guides are eligible.
56538
+ * To improve idle performance, this can be set to `true` and then the web SDK will instead use a mutation
56481
56539
  * observer and only check eligibility if the page content has changed.
56482
56540
  *
56483
56541
  * @access public
@@ -56489,8 +56547,8 @@ var ConfigReader = (function () {
56489
56547
  addOption('preferMutationObserver', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56490
56548
  addOption('preventCookieRefresh');
56491
56549
  /**
56492
- * By default, the Agent adds an `unload` event listener to the page to make sure it sends events upon
56493
- * navigation. If set to `true`, the Agent will instead use the `visibilitychange` event listener and send
56550
+ * By default, the web SDK adds an `unload` event listener to the page to make sure it sends events upon
56551
+ * navigation. If set to `true`, the web SDK will instead use the `visibilitychange` event listener and send
56494
56552
  * events when the visibility is changing to `"hidden"`.
56495
56553
  *
56496
56554
  * @access public
@@ -56502,7 +56560,7 @@ var ConfigReader = (function () {
56502
56560
  addOption('preventUnloadListener', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56503
56561
  addOption('promotedAgentMetadataConfigurations', [PENDO_CONFIG_SRC]);
56504
56562
  /**
56505
- * An array of strings or a function that returns an array of strings. The Agent will then strip any query
56563
+ * An array of strings or a function that returns an array of strings. The web SDK will then strip any query
56506
56564
  * string parameters from the url that are not found in the provided array. **Deprecated:** new usages to
56507
56565
  * edit the url for events should use the [location api](/advanced/location).
56508
56566
  *
@@ -56528,7 +56586,7 @@ var ConfigReader = (function () {
56528
56586
  addOption('sanitizeUrl', [SNIPPET_SRC]);
56529
56587
  addOption('selfHosted');
56530
56588
  /**
56531
- * Meant to be used with `autoFrameInstall`. If set, the Agent will use this as the url to download the Agent
56589
+ * Meant to be used with `autoFrameInstall`. If set, the web SDK will use this as the url to download itself
56532
56590
  * from in child frames. Read more about [frame support](/advanced/auto-frame-install).
56533
56591
  *
56534
56592
  * @access public
@@ -56555,7 +56613,7 @@ var ConfigReader = (function () {
56555
56613
  // Analytics
56556
56614
  /**
56557
56615
  * An array of exact strings that can still be included in event data if text capture is disabled
56558
- * (`excludeAllText`). This will override any allow list that is stored for your application settings.
56616
+ * (`excludeAllText`). This will not override any allow list specified by your application settings but will apply if none is provided.
56559
56617
  * These are not selectors but are equality checks (the string 'Bug' will allow links that have 'Bug' as the
56560
56618
  * text to be captured but not ones like 'Bug Report')
56561
56619
  *
@@ -56565,9 +56623,9 @@ var ConfigReader = (function () {
56565
56623
  * @default []
56566
56624
  * @type {string[]}
56567
56625
  */
56568
- addOption('allowedText', [SNIPPET_SRC, PENDO_CONFIG_SRC], []);
56626
+ addOption('allowedText', [PENDO_CONFIG_SRC, SNIPPET_SRC], [], true);
56569
56627
  /**
56570
- * An array of specific Pendo events that you do not want the Agent to capture. Available event types
56628
+ * An array of specific Pendo events that you do not want the web SDK to capture. Available event types
56571
56629
  * include: `identify`, `meta`, `load`, `click`, `focus`, `submit`, `change`, `track`. See [Event Controls](/events/event-controls)
56572
56630
  * for more information.
56573
56631
  *
@@ -56589,7 +56647,7 @@ var ConfigReader = (function () {
56589
56647
  */
56590
56648
  addOption('analytics.localStorageUnload', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56591
56649
  /**
56592
- * If set to `true`, the Agent will log out when various events internal to the Agent occur.
56650
+ * If set to `true`, the web SDK will log when various internal events occur.
56593
56651
  *
56594
56652
  * @access public
56595
56653
  * @category Config/Analytics
@@ -56613,7 +56671,7 @@ var ConfigReader = (function () {
56613
56671
  */
56614
56672
  addOption('eventPropertyMatchParents', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
56615
56673
  /**
56616
- * By default, the Agent will include text from elements while capturing events. Setting this to `true` will
56674
+ * By default, the web SDK will include text from elements while capturing events. Setting this to `true` will
56617
56675
  * instead prevent the text from being included unless it matches the `allowedText` list. If the subscription
56618
56676
  * flag to disable text capture is turned on, this option cannot be used to reenable it.
56619
56677
  *
@@ -56625,7 +56683,7 @@ var ConfigReader = (function () {
56625
56683
  */
56626
56684
  addOption('excludeAllText', [PENDO_CONFIG_SRC, SNIPPET_SRC], false, true);
56627
56685
  /**
56628
- * When `true`, the Agent will only send guide and poll events. All other events will not be sent, including:
56686
+ * When `true`, the web SDK will only send guide and poll events. All other events will not be sent, including:
56629
56687
  * identify, meta, load, click, focus, change, submit, or track. Metadata assigned to visitors will still function
56630
56688
  * for guide targeting but will not be sent to Pendo to be visible in the UI. See [Event Controls](/events/event-controls)
56631
56689
  * for more information.
@@ -56641,7 +56699,7 @@ var ConfigReader = (function () {
56641
56699
  addOption('htmlAttributes');
56642
56700
  addOption('interceptElementRemoval', [SNIPPET_SRC, PENDO_CONFIG_SRC], false); // old, use syntheticClicks.elementRemoval instead
56643
56701
  /**
56644
- * By default, the agent will attempt to intercept calls to `preventDefault` on `touchend` events in order to
56702
+ * By default, the web SDK will attempt to intercept calls to `preventDefault` on `touchend` events in order to
56645
56703
  * ensure that Pendo still tracks the click event. There are cases where your application might prevent these
56646
56704
  * original clicks in order to synthesize your own click event, in that case and where you might be seeing
56647
56705
  * duplicate clicks because of it, this functionality can be disabled.
@@ -56654,7 +56712,7 @@ var ConfigReader = (function () {
56654
56712
  */
56655
56713
  addOption('interceptPreventDefault', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
56656
56714
  /**
56657
- * By default, the agent will also attempt to intercept calls to `stopPropagation` and
56715
+ * By default, the web SDK will also attempt to intercept calls to `stopPropagation` and
56658
56716
  * `stopImmediatePropagation` for click, focus, submit, and change events in order to ensure that Pendo can
56659
56717
  * still probably recognize these events. In the case of this causing duplicate events or other issues, this
56660
56718
  * functionality can be disabled.
@@ -56669,7 +56727,7 @@ var ConfigReader = (function () {
56669
56727
  /**
56670
56728
  * Sometimes an application removes an event that is clicked on between the `mousedown` and `mouseup` browser
56671
56729
  * events. In these cases, Pendo will not be able to capture the `click` event properly for events or guide
56672
- * behavior. Setting this to `true` will have the Agent intercept these types of element removal to ensure
56730
+ * behavior. Setting this to `true` will have the web SDK intercept these types of element removal to ensure
56673
56731
  * more consistent Pendo behavior (this option has been moved from `interceptElementRemoval`).
56674
56732
  *
56675
56733
  * @access public
@@ -56729,7 +56787,7 @@ var ConfigReader = (function () {
56729
56787
  addOption('cacheGuidesTimeout', [PENDO_CONFIG_SRC], 600000);
56730
56788
  addOption('delayGuides', [SNIPPET_SRC]); // old, use guides.delay instead
56731
56789
  /**
56732
- * If `true`, this will prevent the agent from attempting to launch the Visual Design Studio.
56790
+ * If `true`, this will prevent the web SDK from attempting to launch the Visual Design Studio.
56733
56791
  *
56734
56792
  * @access public
56735
56793
  * @category Config/Guides
@@ -56740,7 +56798,7 @@ var ConfigReader = (function () {
56740
56798
  addOption('disableDesigner', [PENDO_CONFIG_SRC, SNIPPET_SRC], false);
56741
56799
  addOption('disableDesignerKeyboardShortcut', [PENDO_CONFIG_SRC], false);
56742
56800
  /**
56743
- * If `true`, this will prevent the agent from downloading your application's
56801
+ * If `true`, this will prevent the web SDK from downloading your application's
56744
56802
  * [global css](https://support.pendo.io/hc/en-us/articles/360032206511-Guide-Styling-Classic-#global-css-0-2)
56745
56803
  * file as well as the default classic guide css.
56746
56804
  *
@@ -56776,7 +56834,7 @@ var ConfigReader = (function () {
56776
56834
  */
56777
56835
  addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56778
56836
  /**
56779
- * If `true`, the agent will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
56837
+ * If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
56780
56838
  * keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
56781
56839
  *
56782
56840
  * @access public
@@ -56896,8 +56954,8 @@ var ConfigReader = (function () {
56896
56954
  */
56897
56955
  addOption('guides.tooltip.arrowSize', [SNIPPET_SRC]);
56898
56956
  /**
56899
- * If set, the agent will attach the provided value as a [nonce](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#nonces)
56900
- * onto all inline stylesheets the agent adds. This is used to remove the need for "unsafe-inline" on the "style-src" of your
56957
+ * If set, the web SDK will attach the provided value as a [nonce](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#nonces)
56958
+ * onto all inline stylesheets the web SDK adds. This is used to remove the need for "unsafe-inline" on the "style-src" of your
56901
56959
  * CSP and will support live guides as well as Visual Design Studio users.
56902
56960
  *
56903
56961
  * @access public
@@ -56951,7 +57009,7 @@ var ConfigReader = (function () {
56951
57009
  addOption('feedbackSettings', [PENDO_CONFIG_SRC], {});
56952
57010
  addOption('pendoFeedback', [PENDO_CONFIG_SRC], false);
56953
57011
  /**
56954
- * If set, the Agent will use this as the suffix when writing last step advanced key into the visitors cookie.
57012
+ * If set, the web SDK will use this as the suffix when writing last step advanced key into the visitors cookie.
56955
57013
  * This supports cross app guides by having a shared accessible location for different apps on the same effective level domain.
56956
57014
  *
56957
57015
  * @access public
@@ -56962,7 +57020,7 @@ var ConfigReader = (function () {
56962
57020
  */
56963
57021
  addOption('crossAppGuideStorageSuffix', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
56964
57022
  /**
56965
- * If `true`, the Agent will launch a version of the Designer that is compatible with the
57023
+ * If `true`, the web SDK will launch a version of the Designer that is compatible with the
56966
57024
  * `Cross-Origin-Embedder-Policy: require-corp` header.
56967
57025
  *
56968
57026
  * @access public
@@ -58438,4 +58496,405 @@ function NetworkCapture() {
58438
58496
  }
58439
58497
  }
58440
58498
 
58441
- export { ConsoleCapture, Feedback, GuideMarkdown, NetworkCapture, createReplayPlugin as Replay, TextCapture, VocPortal, loadAgent };
58499
+ const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
58500
+ const DRAG_THRESHOLD = 5;
58501
+ const STYLE_ID = 'pendo-predict-plugin-styles';
58502
+ const PREDICT_BASE_URL = 'https://predict.pendo.io';
58503
+ const BUTTON_CLASS_IDENTIFIER = '._pendo-button-primaryButton:contains("token")';
58504
+ const pluginVersion = '1.0.0';
58505
+ const $ = (id) => document.getElementById(id);
58506
+ const createElement = (tag, attrs = {}, parent = null) => {
58507
+ const el = document.createElement(tag);
58508
+ const entries = Object.entries(attrs);
58509
+ for (let i = 0; i < entries.length; i++) {
58510
+ const [key, value] = entries[i];
58511
+ if (key === 'className')
58512
+ el.className = value;
58513
+ else if (key === 'innerHTML')
58514
+ el.innerHTML = value;
58515
+ else
58516
+ el[key] = value;
58517
+ }
58518
+ if (parent)
58519
+ parent.appendChild(el);
58520
+ return el;
58521
+ };
58522
+ const injectStyles = (pendoContainerId) => {
58523
+ if ($(STYLE_ID))
58524
+ return;
58525
+ createElement('style', {
58526
+ id: STYLE_ID,
58527
+ textContent: `
58528
+ #${pendoContainerId} {
58529
+ display: none !important;
58530
+ }
58531
+ .frame-explanation {
58532
+ aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
58533
+ width: 100vw; height: 100vh; background: transparent;
58534
+ position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
58535
+ visibility: hidden; opacity: 0; pointer-events: none;
58536
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
58537
+ display: none;
58538
+ }
58539
+ .frame-explanation.is-visible {
58540
+ visibility: visible; opacity: 1; pointer-events: auto;
58541
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
58542
+ }
58543
+ .frame-explanation.is-exists {
58544
+ display: block !important;
58545
+ }
58546
+ .floating-modal-container {
58547
+ position: fixed; top: 20px; right: 20px; z-index: 500000;
58548
+ visibility: hidden; opacity: 0; pointer-events: none;
58549
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
58550
+ border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
58551
+ overflow: hidden; width: 384px; height: 176px;
58552
+ }
58553
+ .floating-modal-container.is-visible {
58554
+ visibility: visible; opacity: 1; pointer-events: auto;
58555
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
58556
+ }
58557
+ .floating-modal-container.is-dragging { will-change: left, top; }
58558
+ .floating-modal-drag-handle {
58559
+ position: absolute; left: 50%; transform: translateX(-50%);
58560
+ top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
58561
+ z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
58562
+ display: flex; justify-content: center; align-items: center;
58563
+ }
58564
+ .floating-modal-drag-handle svg g { fill: #A0A0A0; }
58565
+ .floating-modal-drag-handle:hover { cursor: grab; }
58566
+ .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
58567
+ .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
58568
+ .floating-modal-drag-handle.is-collapsed { top: 0px; }
58569
+ .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
58570
+ `
58571
+ }, document.head);
58572
+ };
58573
+ const getRecordIdFromUrl = (recordRegex) => {
58574
+ var _a;
58575
+ const match = window.location.href.match(recordRegex);
58576
+ return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
58577
+ };
58578
+ const safeStringify = (value, fallback) => {
58579
+ try {
58580
+ return JSON.stringify(value);
58581
+ }
58582
+ catch (error) {
58583
+ return fallback !== null && fallback !== void 0 ? fallback : '';
58584
+ }
58585
+ };
58586
+ const safeParse = (value, fallback) => {
58587
+ try {
58588
+ return JSON.parse(value);
58589
+ }
58590
+ catch (error) {
58591
+ return fallback;
58592
+ }
58593
+ };
58594
+ const buildQueryParams = (params) => {
58595
+ const urlParams = new URLSearchParams();
58596
+ const entries = Object.entries(params);
58597
+ urlParams.set('pluginVersion', pluginVersion);
58598
+ for (let i = 0; i < entries.length; i++) {
58599
+ const [key, value] = entries[i];
58600
+ if (value != null) {
58601
+ urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
58602
+ }
58603
+ }
58604
+ return urlParams.toString();
58605
+ };
58606
+ // ----- Drag & Drop -----
58607
+ const setupDragAndDrop = (handle, container) => {
58608
+ let isDragging = false;
58609
+ let hasMoved = false;
58610
+ let isCollapsed = false;
58611
+ let startX = 0;
58612
+ let startY = 0;
58613
+ let initialLeft = 0;
58614
+ let initialTop = 0;
58615
+ let rafId = null;
58616
+ const iframe = container.querySelector('iframe');
58617
+ const onMouseDown = (e) => {
58618
+ if (e.button !== 0)
58619
+ return;
58620
+ e.preventDefault();
58621
+ isDragging = true;
58622
+ hasMoved = false;
58623
+ handle.classList.add('is-dragging');
58624
+ container.classList.add('is-dragging');
58625
+ if (iframe)
58626
+ iframe.style.pointerEvents = 'none';
58627
+ const rect = container.getBoundingClientRect();
58628
+ initialLeft = rect.left;
58629
+ initialTop = rect.top;
58630
+ container.style.left = `${initialLeft}px`;
58631
+ container.style.right = 'auto';
58632
+ startX = e.clientX;
58633
+ startY = e.clientY;
58634
+ document.addEventListener('mousemove', onMouseMove);
58635
+ document.addEventListener('mouseup', onMouseUp);
58636
+ };
58637
+ const onMouseMove = (e) => {
58638
+ if (!isDragging)
58639
+ return;
58640
+ const deltaX = e.clientX - startX;
58641
+ const deltaY = e.clientY - startY;
58642
+ if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
58643
+ hasMoved = true;
58644
+ }
58645
+ if (rafId)
58646
+ cancelAnimationFrame(rafId);
58647
+ rafId = requestAnimationFrame(() => {
58648
+ const rect = container.getBoundingClientRect();
58649
+ const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
58650
+ const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
58651
+ container.style.left = `${newLeft}px`;
58652
+ container.style.top = `${newTop}px`;
58653
+ });
58654
+ };
58655
+ const onMouseUp = (e) => {
58656
+ var _a;
58657
+ if (!isDragging)
58658
+ return;
58659
+ isDragging = false;
58660
+ handle.classList.remove('is-dragging');
58661
+ container.classList.remove('is-dragging');
58662
+ if (iframe)
58663
+ iframe.style.pointerEvents = '';
58664
+ if (rafId)
58665
+ cancelAnimationFrame(rafId);
58666
+ rafId = null;
58667
+ document.removeEventListener('mousemove', onMouseMove);
58668
+ document.removeEventListener('mouseup', onMouseUp);
58669
+ if (!hasMoved && isCollapsed && iframe) {
58670
+ (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
58671
+ }
58672
+ };
58673
+ handle.setCollapsedState = (collapsed) => {
58674
+ isCollapsed = collapsed;
58675
+ handle.classList.toggle('is-collapsed', collapsed);
58676
+ };
58677
+ handle.addEventListener('mousedown', onMouseDown);
58678
+ handle.cleanup = () => {
58679
+ handle.removeEventListener('mousedown', onMouseDown);
58680
+ document.removeEventListener('mousemove', onMouseMove);
58681
+ document.removeEventListener('mouseup', onMouseUp);
58682
+ if (rafId)
58683
+ cancelAnimationFrame(rafId);
58684
+ };
58685
+ return handle;
58686
+ };
58687
+ // ----- Explanation Iframe Creation -----
58688
+ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
58689
+ var _a;
58690
+ const frameId = `frameExplanation-${analysisId}`;
58691
+ (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
58692
+ const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
58693
+ const params = buildQueryParams(configuration);
58694
+ createElement('iframe', {
58695
+ id: frameId,
58696
+ className: 'frame-explanation',
58697
+ title: 'Explanation',
58698
+ loading: 'lazy',
58699
+ referrerPolicy: 'strict-origin-when-cross-origin',
58700
+ allowFullscreen: true,
58701
+ src: `${base}?${params}`
58702
+ }, document.body);
58703
+ };
58704
+ // ----- Floating Modal Creation -----
58705
+ const createFloatingModal = ({ recordId, configuration }) => {
58706
+ var _a;
58707
+ const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
58708
+ for (let i = 0; i < flatIds.length; i++) {
58709
+ createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
58710
+ }
58711
+ const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
58712
+ const dragHandle = createElement('div', {
58713
+ className: 'floating-modal-drag-handle',
58714
+ innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
58715
+ <g fill="#EBEBEB">
58716
+ <circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
58717
+ <circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
58718
+ </g>
58719
+ </svg>`
58720
+ }, container);
58721
+ const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
58722
+ const params = buildQueryParams(configuration);
58723
+ createElement('iframe', {
58724
+ id: 'frameFloatingModal',
58725
+ className: 'frame-floating-modal',
58726
+ loading: 'lazy',
58727
+ referrerPolicy: 'strict-origin-when-cross-origin',
58728
+ allowFullscreen: true,
58729
+ title: 'Floating Modal',
58730
+ src: `${baseUrl}?${params}`
58731
+ }, container);
58732
+ container.dragHandle = setupDragAndDrop(dragHandle, container);
58733
+ return () => {
58734
+ var _a, _b, _c;
58735
+ (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
58736
+ container.remove();
58737
+ const flatIds = (_c = configuration.analysisIds) === null || _c === void 0 ? void 0 : _c.flat(Infinity);
58738
+ for (let i = 0; i < flatIds.length; i++) {
58739
+ const frame = $(`frameExplanation-${flatIds[i]}`);
58740
+ if (frame)
58741
+ frame.remove();
58742
+ }
58743
+ };
58744
+ };
58745
+ const setupMessageListener = ({ token, cleanup, pendo }) => {
58746
+ const messageHandler = ({ origin, data }) => {
58747
+ var _a;
58748
+ if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
58749
+ return;
58750
+ const { type, analysisId, height, width } = data;
58751
+ const explanationFrame = $(`frameExplanation-${analysisId}`);
58752
+ const floatingModal = $('floatingModalContainer');
58753
+ const setFloatingModalSize = () => {
58754
+ if (floatingModal) {
58755
+ floatingModal.style.height = `${height}px`;
58756
+ floatingModal.style.width = `${width}px`;
58757
+ }
58758
+ };
58759
+ const setFloatingModalCollapsedState = (collapsed) => {
58760
+ var _a, _b;
58761
+ if (floatingModal)
58762
+ (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
58763
+ };
58764
+ const actions = {
58765
+ MODAL_INITIALIZED: () => {
58766
+ var _a, _b, _c;
58767
+ const iframe = $('frameFloatingModal');
58768
+ if (iframe) {
58769
+ let idToken = null;
58770
+ let extensionAPIKeys = null;
58771
+ const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
58772
+ if (pendo._.isFunction(retrieveIDPToken)) {
58773
+ const result = retrieveIDPToken();
58774
+ if (result) {
58775
+ idToken = result.idToken;
58776
+ extensionAPIKeys = result.extensionAPIKeys;
58777
+ }
58778
+ }
58779
+ const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
58780
+ const accountId = (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
58781
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
58782
+ }
58783
+ },
58784
+ OPEN_EXPLANATION: () => {
58785
+ var _a;
58786
+ explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
58787
+ (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
58788
+ },
58789
+ CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
58790
+ AUTH_ERROR_EXPLANATION: () => {
58791
+ explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
58792
+ const iframe = $('frameFloatingModal');
58793
+ // eslint-disable-next-line no-self-assign
58794
+ if (iframe)
58795
+ iframe.src = iframe.src;
58796
+ },
58797
+ DATA_READY: () => {
58798
+ floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
58799
+ setFloatingModalSize();
58800
+ // Use analysisIds from the message data if available, otherwise use all IDs
58801
+ const idsToShow = data.analysisIds || [];
58802
+ for (let i = 0; i < idsToShow.length; i++) {
58803
+ const frame = $(`frameExplanation-${idsToShow[i]}`);
58804
+ if (frame)
58805
+ frame.classList.add('is-exists');
58806
+ }
58807
+ },
58808
+ AUTH_ERROR: () => {
58809
+ floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
58810
+ setFloatingModalSize();
58811
+ },
58812
+ CLOSE_FLOATING_MODAL: cleanup,
58813
+ EXPAND_FLOATING_MODAL: () => {
58814
+ setFloatingModalSize();
58815
+ setFloatingModalCollapsedState(false);
58816
+ },
58817
+ COLLAPSE_FLOATING_MODAL: () => {
58818
+ setFloatingModalSize();
58819
+ setFloatingModalCollapsedState(true);
58820
+ }
58821
+ };
58822
+ if (type && type in actions) {
58823
+ (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
58824
+ }
58825
+ };
58826
+ window.addEventListener('message', messageHandler);
58827
+ return () => window.removeEventListener('message', messageHandler);
58828
+ };
58829
+ const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup }) => {
58830
+ var _a;
58831
+ // ----- Extract Configuration -----
58832
+ const pendoButtonPrimaryButton = (_a = step.guideElement.find(BUTTON_CLASS_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
58833
+ if (!pendoButtonPrimaryButton)
58834
+ return;
58835
+ const _b = safeParse(pendoButtonPrimaryButton.textContent, null), { token } = _b, configuration = __rest(_b, ["token"]);
58836
+ if (!configuration)
58837
+ return;
58838
+ const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
58839
+ injectStyles(pendoContainerId);
58840
+ const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]{15,18})(?:/|$)`);
58841
+ const recordId = getRecordIdFromUrl(recordRegex);
58842
+ if (!recordId)
58843
+ return;
58844
+ cleanupArray.push(setupMessageListener({ token, cleanup, pendo }));
58845
+ cleanupArray.push(createFloatingModal({ recordId, configuration }));
58846
+ };
58847
+
58848
+ const PredictGuides = () => {
58849
+ let pluginApiRef = null;
58850
+ let cleanupArray = [];
58851
+ const cleanup = () => {
58852
+ for (let i = 0; i < cleanupArray.length; i++) {
58853
+ try {
58854
+ cleanupArray[i]();
58855
+ }
58856
+ catch (_a) { }
58857
+ }
58858
+ cleanupArray = [];
58859
+ };
58860
+ const initialize = (_pendo, PluginAPI) => {
58861
+ pluginApiRef = PluginAPI;
58862
+ const configReader = PluginAPI.ConfigReader;
58863
+ const PREDICT_GUIDES_CONFIG = 'predictGuides';
58864
+ configReader.addOption(PREDICT_GUIDES_CONFIG, [
58865
+ configReader.sources.SNIPPET_SRC,
58866
+ configReader.sources.PENDO_CONFIG_SRC
58867
+ ], false);
58868
+ const predictGuidesEnabled = configReader.get(PREDICT_GUIDES_CONFIG);
58869
+ if (!predictGuidesEnabled)
58870
+ return;
58871
+ pluginApiRef.Events.urlChanged.on(cleanup);
58872
+ const script = {
58873
+ name: 'PredictFrameScript',
58874
+ script(step, _guide, pendo) {
58875
+ predictGuidesScript({ step, pendo, cleanupArray, cleanup });
58876
+ this.on('unmounted', (evt) => {
58877
+ if (evt.reason !== 'hidden')
58878
+ cleanup();
58879
+ });
58880
+ },
58881
+ test(step, _guide) {
58882
+ const stepName = step.name || '';
58883
+ return PREDICT_STEP_REGEX.test(stepName);
58884
+ }
58885
+ };
58886
+ pluginApiRef.GlobalRuntime.addGlobalScript(script);
58887
+ };
58888
+ const teardown = () => {
58889
+ var _a, _b;
58890
+ cleanup();
58891
+ (_b = (_a = pluginApiRef === null || pluginApiRef === void 0 ? void 0 : pluginApiRef.Events) === null || _a === void 0 ? void 0 : _a.urlChanged) === null || _b === void 0 ? void 0 : _b.off(cleanup);
58892
+ };
58893
+ return {
58894
+ name: 'PredictGuides',
58895
+ initialize,
58896
+ teardown
58897
+ };
58898
+ };
58899
+
58900
+ export { ConsoleCapture, Feedback, GuideMarkdown, NetworkCapture, PredictGuides, createReplayPlugin as Replay, TextCapture, VocPortal, loadAgent };