userflow.js-self-hosted 0.1.1026943 → 0.1.1026945
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.
- package/hash.txt +1 -1
- package/package.json +1 -1
- package/userflow.js +1 -1
- package/vendor.object-assign.js +1 -1
package/hash.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
013d941747dbb485ab37dc7c3c1bd6ea1133aac6
|
package/package.json
CHANGED
package/userflow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterApp.js","vendor.react.js","vendor.object-assign.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","flow-host.styl.js","TreeDoc.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.obj-str.js","use-selector-element-monitoring.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","iframe-reset.styl.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","use-confetti.js","vendor.canvas-confetti.js","AnnouncementEngagement.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","BannerApp.js","vendor.phoenix.js","vendor.uuid.js","SitePage.js","vendor.react-router-dom.js","vendor.react-router.js","vendor.prop-types.js","vendor.history.js","vendor.resolve-pathname.js","vendor.value-equal.js","vendor.tiny-invariant.js","vendor.mini-create-react-context.js","vendor.path-to-regexp.js","vendor.react-is.js","Popover.js","react-hooks.js","vendor.lodash.js","implicit-tracking.js","DebuggerUI.js","ui.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import"./vendor.object-assign.js";import{S as J}from"./vendor.phoenix.js";import{v as b}from"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="337c0fda-30ce-4938-9f65-be34a7346ad6",t._sentryDebugIdIdentifier="sentry-dbid-337c0fda-30ce-4938-9f65-be34a7346ad6")}catch{}})();const Q="modulepreload",X=function(t){return new URL("./",import.meta.url).toString()+t},D={},I=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let u=function(c){return Promise.all(c.map(E=>Promise.resolve(E).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=u(s.map(c=>{if(c=X(c),c in D)return;D[c]=!0;const E=c.endsWith(".css"),g=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const T=document.createElement("link");if(T.rel=E?"stylesheet":Q,E||(T.as="script"),T.crossOrigin="",T.href=c,l&&T.setAttribute("nonce",l),document.head.appendChild(T),E)return new Promise((Y,z)=>{T.addEventListener("load",Y),T.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};class d extends Error{constructor(e,s,n){super(e),Object.setPrototypeOf(this,d.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class G{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].getItem(e):null}setItem(e,s){e=this.formatKey(e);{if(!this.isSupported())return;window[this.type].setItem(e,s)}}removeItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].removeItem(e):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const C=new G("localStorage"),h=new G("sessionStorage");function Et(t){window.location.href=t}function U(){return window.location.href}function A(t){window.postMessage(t,window.origin)}function x(t){const e=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||t(i)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function Z(t){return new Promise(e=>{x(s=>{const n=t(s);return n?(e(n),!0):!1})})}const R=new Set;let y=!1;function q(t){return ee(),R.add(t),()=>{F(t)}}function F(t){R.delete(t)}function m(){R.forEach(t=>t())}function ee(){if(y)return;y=!0;const{history:t}=window,e=s=>{const n=t[s];t[s]=(...i)=>{const r=n.apply(t,i);return m(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{m()}),window.addEventListener("userflow:replacestate",()=>{m()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{m()})}class te{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){A({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=x(e),!1}async captureScreenshot(e,s,n,i){return A({kind:"userflow:crxScreenshot",x:e,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await Z(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var k=(t=>(t.ACTION="ACTION",t.ELEMENT_MISSING="ELEMENT_MISSING",t.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",t.WORKFLOW_TIMED_OUT="WORKFLOW_TIMED_OUT",t.REPLACED="REPLACED",t.SNOOZED="SNOOZED",t.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",t.USERFLOWJS="USERFLOWJS",t.USER_CLOSED="USER_CLOSED",t))(k||{}),se=(t=>(t.POSITIVE="POSITIVE",t.NEUTRAL="NEUTRAL",t.NEGATIVE="NEGATIVE",t))(se||{}),ie=(t=>(t.USER_INPUT_TIMEOUT="USER_INPUT_TIMEOUT",t.STEP_TIMEOUT="STEP_TIMEOUT",t))(ie||{}),ne=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(ne||{}),N=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t.ASSISTANT="ASSISTANT",t))(N||{}),re=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(re||{}),S=(t=>(t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.NUMBER="NUMBER",t.DATETIME="DATETIME",t.LIST="LIST",t.RANDOM_AB="RANDOM_AB",t.RANDOM_NUMBER="RANDOM_NUMBER",t.CHECKLIST_TASK="CHECKLIST_TASK",t.FLOW="FLOW",t.FLOW_SESSION="FLOW_SESSION",t.FLOW_STEP="FLOW_STEP",t.FLOW_VERSION="FLOW_VERSION",t))(S||{}),L=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t.SITE="SITE",t.WORKFLOW="WORKFLOW",t))(L||{}),oe=(t=>(t.ALWAYS_TRUE="ALWAYS_TRUE",t.ATTRIBUTE="ATTRIBUTE",t.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",t.CLAUSE="CLAUSE",t.ELEMENT="ELEMENT",t.EVENT="EVENT",t.FILLED_IN_INPUT="FILLED_IN_INPUT",t.FLOW="FLOW",t.INPUT_VALUE="INPUT_VALUE",t.PAGE="PAGE",t.SCREEN="SCREEN",t.SEGMENT="SEGMENT",t.TIME="TIME",t))(oe||{}),ae=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ae||{}),ce=(t=>(t.INPUT="INPUT",t))(ce||{}),le=(t=>(t.ABSOLUTE_EQ="ABSOLUTE_EQ",t.ABSOLUTE_GT="ABSOLUTE_GT",t.ABSOLUTE_LT="ABSOLUTE_LT",t.AND="AND",t.BETWEEN="BETWEEN",t.CONTAINS="CONTAINS",t.EMPTY="EMPTY",t.ENDS_WITH="ENDS_WITH",t.EQ="EQ",t.EXCLUDES_ALL="EXCLUDES_ALL",t.EXCLUDES_ANY="EXCLUDES_ANY",t.FALSE="FALSE",t.GT="GT",t.GTE="GTE",t.INCLUDES_ALL="INCLUDES_ALL",t.INCLUDES_ANY="INCLUDES_ANY",t.LT="LT",t.LTE="LTE",t.NE="NE",t.NOT_CONTAINS="NOT_CONTAINS",t.NOT_EMPTY="NOT_EMPTY",t.NOT_REGEX="NOT_REGEX",t.OR="OR",t.REGEX="REGEX",t.RELATIVE_EQ="RELATIVE_EQ",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t.STARTS_WITH="STARTS_WITH",t.TRUE="TRUE",t.URL="URL",t))(le||{}),ue=(t=>(t.CLICK="CLICK",t.DISABLED="DISABLED",t.MOUSEDOWN="MOUSEDOWN",t.NOT_CLICK="NOT_CLICK",t.NOT_DISABLED="NOT_DISABLED",t.NOT_PRESENT="NOT_PRESENT",t.PRESENT="PRESENT",t))(ue||{}),he=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(he||{}),de=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(de||{}),fe=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(fe||{}),Ee=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(Ee||{}),Se=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(Se||{}),Te=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(Te||{}),Ie=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_CENTER="TOP_CENTER",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t.BOTTOM_CENTER="BOTTOM_CENTER",t.BOTTOM_LEFT="BOTTOM_LEFT",t.CENTER="CENTER",t))(Ie||{}),ge=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(ge||{}),we=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(we||{}),ke=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(ke||{}),Ce=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(Ce||{}),me=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(me||{}),Ue=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(Ue||{}),Le=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(Le||{}),pe=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(pe||{}),Ne=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(Ne||{}),_e=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(_e||{}),ve=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(ve||{}),Ae=(t=>(t.CLOSE_FLOW="CLOSE_FLOW",t.EVAL_JS="EVAL_JS",t.GO_TO_STEP="GO_TO_STEP",t.NAVIGATE="NAVIGATE",t.SET_ATTRIBUTE="SET_ATTRIBUTE",t.SNOOZE="SNOOZE",t.START_FLOW="START_FLOW",t.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",t))(Ae||{}),Re=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Re||{}),Oe=(t=>(t.SET="SET",t.SET_DATETIME="SET_DATETIME",t.SET_DATETIME_ONCE="SET_DATETIME_ONCE",t.SET_ONCE="SET_ONCE",t.ADD="ADD",t.SUBTRACT="SUBTRACT",t.APPEND="APPEND",t.PREPEND="PREPEND",t.REMOVE="REMOVE",t.UNSET="UNSET",t))(Oe||{}),be=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(be||{}),De=(t=>(t.CLICK="CLICK",t.FILL="FILL",t.NAVIGATE="NAVIGATE",t))(De||{}),p=(t=>(t.ACTION="ACTION",t.ANNOUNCEMENTS="ANNOUNCEMENTS",t.ASSISTANT="ASSISTANT",t.CHECKLIST="CHECKLIST",t.CONTACT="CONTACT",t.DIVIDER="DIVIDER",t.FLOWS="FLOWS",t.KNOWLEDGE_BASE="KNOWLEDGE_BASE",t.MESSAGE="MESSAGE",t.SUBPAGE="SUBPAGE",t))(p||{}),ye=(t=>(t.CRISP="CRISP",t.CUSTOM="CUSTOM",t.FRESHCHAT="FRESHCHAT",t.HELPSCOUT="HELPSCOUT",t.HUBSPOT="HUBSPOT",t.INTERCOM="INTERCOM",t.ZENDESK="ZENDESK",t.ZENDESK_MESSENGER="ZENDESK_MESSENGER",t))(ye||{}),Me=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(Me||{}),Pe=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(Pe||{}),Be=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(Be||{}),He=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(He||{}),We=(t=>(t.LAUNCHER_CLICK="LAUNCHER_CLICK",t.LAUNCHER_HOVER="LAUNCHER_HOVER",t.TARGET_CLICK="TARGET_CLICK",t.TARGET_HOVER="TARGET_HOVER",t.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",t.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",t))(We||{}),V=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(V||{}),Ge=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Ge||{}),xe=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(xe||{}),Fe=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(Fe||{}),Ve=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(Ve||{}),Ke=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(Ke||{}),$e=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))($e||{}),je=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(je||{}),K=(t=>(t.CHECKLIST="CHECKLIST",t))(K||{}),Ye=(t=>(t.INITIAL="INITIAL",t.FOLLOWUP="FOLLOWUP",t))(Ye||{}),ze=(t=>(t.FLOW="FLOW",t.WORKFLOW="WORKFLOW",t))(ze||{}),Je=(t=>(t.HIDE="HIDE",t.OTHERS="OTHERS",t))(Je||{}),Qe=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Qe||{}),Xe=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(Xe||{}),Ze=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(Ze||{}),qe=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))(qe||{});function et(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[t=>!t.match(/\d$/)],"data-id":[t=>!t.match(/\d$/)]},inferenceClassNameFilters:[t=>!t.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=et();function M(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function St(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function tt(){let t=U();if(f.urlFilter){if(t=f.urlFilter(t),typeof t!="string")throw new d("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(t)}catch(e){throw new d(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
|
|
3
3
|
Returned URL: `+t+`
|
|
4
|
-
Error message: `+e.message)}}return t}let $="";try{$=localStorage.getItem("debug")||""}catch{}const j=$.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=O("log");o.group=O("group");o.groupCollapsed=O("groupCollapsed");o.groupEnd=function(){j&&console.groupEnd()};let _;function O(t){return function(e,...s){if(j){const n=performance.now(),i=_?Math.round(n-_):0;_=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const st=()=>I(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]));function it(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class P{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const B=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],nt=()=>I(()=>import("./BannerApp.js"),__vite__mapDeps([31,1,2,3,4,5,6,15,12,13,14,9,10,11,8,7,16,18,19,17,20,30,21,32,33]));function rt(t){if(!t)return null;let e;"block"in t&&t.block!=null&&(e=t.block.cvid);const s={kind:t.kind,blockCvid:e};return t.kind==="announcementShow"&&(s.announcementId=t.announcementId),JSON.stringify(s)}function Tt(t,e){if(!e)return null;const s=JSON.parse(e);let n;if(s.blockCvid&&(n=t.version.resourceCenter?.blocks.find(r=>r.cvid===s.blockCvid)),!n&&s.kind!=="search")return null;const i={kind:s.kind,block:n};return i.kind==="announcementShow"&&(i.announcementId=s.announcementId),i}const v="1026943",ot=import.meta.url,H=50,at=300*1e3,W="userflowClientState",w="userflowClientSiteId";class ct{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.workflowSession=null,this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(r=>({...r,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),h.setItem("previewFlowId",e.flowId);const i=h.getItem("assistantPreviewId");i&&h.removeItem("assistantConversationId:"+i),e.assistantPreviewId?(h.setItem("assistantPreviewId",e.assistantPreviewId),h.removeItem("assistantConversationId:"+e.assistantPreviewId)):h.removeItem("assistantPreviewId"),(i||e.assistantPreviewId)&&this.emit("private:assistantPreviewChanged"),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(r=>({...r,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(e.assistantPreviewId&&this.workflowSession&&this.endFlow(this.workflowSession,{endReason:k.REPLACED}),this.startFlowWithToken(e.token),e.isResourceCenter){const r=()=>{const a=this.resourceCenterSession;a&&a.draftMode&&a.flow.id===e.flowId&&(e.assistantPreviewId&&this.navigateToAssistantChat(a),this.openResourceCenter(),this.off("resourceCenterChanged",r))};this.on("resourceCenterChanged",r),r()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),H))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{h.setItem(w,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await I(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([34,1,2,3,4,5,6,18,19,35,36,37,38,39,40,41,42,43,44,27,15,12,13,14,9,10,11,25,26,20,8,45,28,46,47,32,33]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+v),q(this.onUrlChange),this.setTargetEnv(new te),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of B)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),F(this.onUrlChange),this.destroyTargetEnv();for(const e of B)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new d("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());h.setItem(W,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=h.getItem(W);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new d("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new d("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new d("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new d("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(ot).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new J(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
|
|
4
|
+
Error message: `+e.message)}}return t}let $="";try{$=localStorage.getItem("debug")||""}catch{}const j=$.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=O("log");o.group=O("group");o.groupCollapsed=O("groupCollapsed");o.groupEnd=function(){j&&console.groupEnd()};let _;function O(t){return function(e,...s){if(j){const n=performance.now(),i=_?Math.round(n-_):0;_=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const st=()=>I(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]));function it(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class P{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const B=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],nt=()=>I(()=>import("./BannerApp.js"),__vite__mapDeps([31,1,2,3,4,5,6,15,12,13,14,9,10,11,8,7,16,18,19,17,20,30,21,32,33]));function rt(t){if(!t)return null;let e;"block"in t&&t.block!=null&&(e=t.block.cvid);const s={kind:t.kind,blockCvid:e};return t.kind==="announcementShow"&&(s.announcementId=t.announcementId),JSON.stringify(s)}function Tt(t,e){if(!e)return null;const s=JSON.parse(e);let n;if(s.blockCvid&&(n=t.version.resourceCenter?.blocks.find(r=>r.cvid===s.blockCvid)),!n&&s.kind!=="search")return null;const i={kind:s.kind,block:n};return i.kind==="announcementShow"&&(i.announcementId=s.announcementId),i}const v="1026945",ot=import.meta.url,H=50,at=300*1e3,W="userflowClientState",w="userflowClientSiteId";class ct{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.workflowSession=null,this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(r=>({...r,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),h.setItem("previewFlowId",e.flowId);const i=h.getItem("assistantPreviewId");i&&h.removeItem("assistantConversationId:"+i),e.assistantPreviewId?(h.setItem("assistantPreviewId",e.assistantPreviewId),h.removeItem("assistantConversationId:"+e.assistantPreviewId)):h.removeItem("assistantPreviewId"),(i||e.assistantPreviewId)&&this.emit("private:assistantPreviewChanged"),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(r=>({...r,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(e.assistantPreviewId&&this.workflowSession&&this.endFlow(this.workflowSession,{endReason:k.REPLACED}),this.startFlowWithToken(e.token),e.isResourceCenter){const r=()=>{const a=this.resourceCenterSession;a&&a.draftMode&&a.flow.id===e.flowId&&(e.assistantPreviewId&&this.navigateToAssistantChat(a),this.openResourceCenter(),this.off("resourceCenterChanged",r))};this.on("resourceCenterChanged",r),r()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),H))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{h.setItem(w,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await I(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([34,1,2,3,4,5,6,18,19,35,36,37,38,39,40,41,42,43,44,27,15,12,13,14,9,10,11,25,26,20,8,45,28,46,47,32,33]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+v),q(this.onUrlChange),this.setTargetEnv(new te),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of B)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),F(this.onUrlChange),this.destroyTargetEnv();for(const e of B)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new d("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());h.setItem(W,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=h.getItem(W);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new d("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new d("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new d("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new d("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(ot).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new J(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
|
|
5
5
|
Details:
|
|
6
6
|
`+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await I(()=>import("./implicit-tracking.js"),__vite__mapDeps([48,11,2,33,32])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){let e;h.getItem(w)&&(e=new URL(U()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:v,signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,bannerSessionId:this.bannerSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,siteSessionId:this.siteSession?.id||null,launchers:this.launcherSessions.map(r=>({flowId:r.flow.id})),trackers:Array.from(this.trackers.values()).map(r=>({flowId:r.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(r=>({conditionId:r.condition.id,isTrue:r.isTrue})),previewFlowId:h.getItem("previewFlowId"),assistantPreviewId:h.getItem("assistantPreviewId"),announcementPreviewId:e,clientContext:n};return o("channel join payload",i),i}disconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.socket&&this.socket.disconnect(),this._socketStatus="disconnected",this.socket=null,this.channel=null}debounceInactiveDisconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.debounceInactiveDisconnectTimeout=window.setTimeout(()=>{if(this.hasDraftSession()||this.assistantMessageInProgress){this.debounceInactiveDisconnect();return}o("disconnecting from socket due to inactivity"),this.disconnect()},at)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(e=>e.draftMode)}async send(e,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(e.kind))&&this.checkPushRateLimit(),this.ensureConnected(),s&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),n?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},H)),this.sendRaw(e,{handlesRejection:i})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,n=e.includes("cff_implicit_events")===!1;for(const i of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:l,reject:u}=i;if(n&&r.kind==="TrackRawEvent"){l("skipped due to disabled implicit events");continue}if(s&&(r.kind==="TrackEvent"&&r.name==="page_viewed"||r.kind==="TrackRawEvent"&&r.name==="page_viewed")){l("skipped due to disabled page views tracking");continue}this._sendToChannel(r,l,u,{handlesRejection:a})}this.initialMessagesQueue=[]}async sendRaw(e,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:e,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(e,n,i,{handlesRejection:s})})}_sendToChannel(e,s,n,{handlesRejection:i}={}){if(!this.channel){const u=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(i)throw Error(u);console.log(u,`
|
|
7
7
|
Client message:`,e);return}o(`push ${e.kind} message`,e);const r=this.clientClock,a=()=>{this.serverClock=r,this.channel?.off("phx_error",l)},l=this.channel.on("phx_error",u=>{a();const c=`Userflow.js send ${e.kind} got phx_error`;this._socketStatus==="connected"&&console.log(c,`
|
package/vendor.object-assign.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="d7ccffdb-8f67-4795-aaba-39e9bc725d6b",e._sentryDebugIdIdentifier="sentry-dbid-d7ccffdb-8f67-4795-aaba-39e9bc725d6b")}catch{}})();var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};p.SENTRY_RELEASE={id:"81ab0cc4e756f7728ac3ed254c102359b71faf7a"};var y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,b;function j(){if(b)return i;b=1;var e=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;function u(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function g(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var d={},r=0;r<10;r++)d["_"+String.fromCharCode(r)]=r;var a=Object.getOwnPropertyNames(d).map(function(n){return d[n]});if(a.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(n){o[n]=n}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return i=g()?Object.assign:function(t,d){for(var r,a=u(t),o,n=1;n<arguments.length;n++){r=Object(arguments[n]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);if(e){o=e(r);for(var f=0;f<o.length;f++)c.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a},i}export{y as c,w as g,j as r};
|
|
2
2
|
//# sourceMappingURL=vendor.object-assign.js.map
|