@datadog/browser-rum-shopify 7.12.0 → 7.13.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.
- package/README.md +8 -27
- package/bundle/chunks/datadogProfiler-50221e48fe37730dfc99-datadog-rum-shopify.js +1 -0
- package/bundle/chunks/{datadogRecorder-45abbe958d6aa05af20d-datadog-rum-shopify.js → datadogRecorder-dd7cb1faa74134e26422-datadog-rum-shopify.js} +1 -1
- package/bundle/datadog-rum-shopify.js +1 -1
- package/package.json +5 -5
- package/bundle/chunks/datadogProfiler-7cb985d2515d29fe6c9e-datadog-rum-shopify.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/browser-rum-shopify",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "cjs/entries/main.js",
|
|
6
6
|
"module": "esm/entries/main.mjs",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"prepack": "yarn build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@datadog/browser-core": "7.
|
|
23
|
-
"@datadog/browser-rum": "7.
|
|
24
|
-
"@datadog/browser-rum-core": "7.
|
|
25
|
-
"@datadog/js-core": "0.0.
|
|
22
|
+
"@datadog/browser-core": "7.13.0",
|
|
23
|
+
"@datadog/browser-rum": "7.13.0",
|
|
24
|
+
"@datadog/browser-rum-core": "7.13.0",
|
|
25
|
+
"@datadog/js-core": "0.0.14"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const __webpack_esm_id__="datadogProfiler";export const __webpack_esm_ids__=["datadogProfiler"];export const __webpack_esm_modules__={7492(e,t,n){n.d(t,{createRumProfiler:()=>R});var s=n(2128),a=n(8333),i=n(9305),o=n(4490),r=n(4215),l=n(3236),c=n(6447),u=n(5648),d=n(9671);function p(){const e=(0,i.Y9)();return t=>{e.send("profile",t)}}var v=n(4512);function f(e,t,n){const s=(0,v.wP)(e,t,n,6);return({profile:e,trace:t})=>{const n={event:e,"wall-time.json":t};s.send(n)}}const m=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g,k=(e,t)=>e||function(e){return e?e.replace(m,"/?"):"/"}(t);var b=n(98);function _(e,t,n){const s=(0,b.m5)(t),i=function(e,t,n){const{ids:s,names:a}=function(e){const t={ids:[],names:[]};for(const n of e)t.ids.push(n.viewId),n.viewName&&t.names.push(n.viewName);return t.names=Array.from(new Set(t.names)),t}(e.views),i=e.longTasks.map(e=>e.id).filter(e=>void 0!==e),o=e.actions?.map(e=>e.id).filter(e=>void 0!==e)??[],{ids:r,labels:l}=function(e){const t={ids:[],labels:[]};if(!e)return t;for(const n of e)t.ids.push(n.id),t.labels.push(n.label);return t.labels=Array.from(new Set(t.labels)),t}(e.vitals),c={application:{id:t}};return n&&(c.session={id:n}),s.length&&(c.view={id:s,name:a}),i.length&&(c.long_task={id:i}),o.length&&(c.action={id:o,label:[]}),r.length&&(c.vital={id:r,label:l}),c}(e,t.applicationId,n),o=function(e){return e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}(s);return{...i,attachments:["wall-time.json"],start:new Date(e.startClocks.timeStamp).toISOString(),end:new Date(e.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:o.join(","),_dd:{clock_drift:(0,a._O)()}}}var g=n(603),w=n(2511);const h=g.AQ;function y(e){const t=(0,w.qj)({expireDelay:h});return e.subscribe(13,({rawRumEvent:e,startClocks:n,duration:s})=>{"long_task"===e.type&&t.add({id:e.long_task.id,startClocks:n,duration:s,entryType:e.long_task.entry_type===v.K.LONG_TASK?v.do.LONG_TASK:v.do.LONG_ANIMATION_FRAME},n.relative).close((0,a.Gw)(n.relative,s))}),t}const I=g.AQ;function C(e){const t=(0,w.qj)({expireDelay:I});return e.subscribe(16,e=>{t.add({id:e.id,label:"",startClocks:e.startClocks,duration:void 0},e.startClocks.relative)}),e.subscribe(13,({rawRumEvent:e,startClocks:n,duration:s})=>{if("action"===e.type){const i=t.getEntries(n.relative).find(t=>t.value.id===e.action.id),o=s??0;i?(i.value.duration=o,i.close((0,a.Gw)(n.relative,o))):t.add({id:e.action.id,label:"",startClocks:n,duration:s},n.relative).close((0,a.Gw)(n.relative,o))}}),t}const T=g.AQ;function D(e){const t=(0,w.qj)({expireDelay:T});return e.subscribe(17,e=>{t.add({id:e.id,type:v.DL.DURATION,startClocks:e.startClocks,duration:void 0,label:e.name},e.startClocks.relative)}),e.subscribe(13,({rawRumEvent:e,startClocks:n,duration:s})=>{if("vital"!==e.type)return;if(e.vital.type===v.DL.OPERATION_STEP){if("start"===e.vital.step_type)t.add({id:e.vital.id,type:e.vital.type,operationKey:e.vital.operation_key,startClocks:n,label:e.vital.name},n.relative);else if("end"===e.vital.step_type){const s=t.findAllEntries().find(t=>t.value.type===v.DL.OPERATION_STEP&&t.value.label===e.vital.name&&t.value.operationKey===e.vital.operation_key);if(!s)return;s.value.duration=(0,a.vk)(s.value.startClocks.relative,n.relative),s.close(n.relative)}return}const i=t.getEntries(n.relative).find(t=>t.value.id===e.vital.id);if(i)return i.value.duration=s,void i.close((0,a.Gw)(n.relative,s));t.add({id:e.vital.id,type:e.vital.type,operationKey:e.vital.operation_key,startClocks:n,duration:s,label:e.vital.name},n.relative).close((0,a.Gw)(n.relative,s))}),t}var E=n(465),S=n(5387);function q(e,t,n=5e3){const s=function(e,t){return(0,S.Hg)({proxy:e.proxy,site:e.site,path:"/api/v2/profiling/quota",parameters:"session_id="+t,subdomain:"quota"})}(e,t),a=new AbortController;let i;const o=(0,E.h)(s,{credentials:"omit",signal:a.signal,headers:new Headers({"DD-CLIENT-TOKEN":e.clientToken})}).then(e=>{const t=429===e.status?{decision:"quota_ko",reason:"quota_exceeded"}:{decision:"quota_ok",reason:"api-error"};return e.json().then(e=>((0,d.DJ)(i),function(e,t){const n=e?.data?.attributes;if(!n||"boolean"!=typeof n.admitted||"string"!=typeof n.reason)return t;const s="backend_client_not_initialized"===n.reason?"backend_unavailable":n.reason;return{decision:n.admitted?"quota_ok":"quota_ko",reason:s}}(e,t)),()=>((0,d.DJ)(i),t))}).catch(()=>((0,d.DJ)(i),{decision:"quota_ok",reason:"api-error"})),r=new Promise(e=>{i=(0,d.wg)(()=>{a.abort(),e({decision:"quota_ok",reason:"timeout"})},n)});return Promise.race([o,r])}var A=n(8032);function M(e){const t=new Map((0,A.Jv)(e)?.map(e=>[e.url,e.id])),n=[];return e.forEach((e,s)=>{const a=t.get(e);void 0!==a&&n.push({resourceId:s,debugId:a})}),n.length?n:void 0}const P={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3};function R(e,t,n,v,m,b,g=P){const w=(0,i.d0)()?(0,o.B)(p)():(0,o.B)(f)(e,t,m);let h;const I=[],T=(0,o.B)(y)(t),E=(0,o.B)(C)(t),S=(0,o.B)(D)(t);let A={state:"stopped",stateReason:"initializing"},R=0;function x(){if("running"===A.state)return;const t=b.findView();h=t?{startClocks:t.startClocks,viewId:t.id,viewName:k(t.name,document.location.pathname)}:void 0,I.push((0,l.q2)(window,"visibilitychange",B).stop,(0,l.q2)(window,"beforeunload",J).stop),N(),function(){if((0,i.d0)())return;const t=++R,s=n.findTrackedSession()?.id;s&&(0,o.B)(q)(e,s).then(e=>{t===R&&("running"!==A.state&&"paused"!==A.state||"quota_ko"===e.decision&&O("quota_ko",e.reason))}).catch(c.Dx)}()}function O(e,t){!function(e){if("running"!==A.state)return void(("paused"===A.state||"stopped"===A.state&&"stopped-by-user"===e)&&(A={state:"stopped",stateReason:e}));const t=A;A={state:"stopped",stateReason:e},t.cleanupTasks.forEach(e=>e()),"quota_ko"===e?((0,d.DJ)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",G),t.profiler.stop().catch(c.Dx)):j(t)}(e),I.forEach(e=>e()),I.length=0,v.set({status:"stopped",error_reason:void 0,quota_reason:t})}function N(){const e=s.J.Profiler;if(!e)throw v.set({status:"error",error_reason:"not-supported-by-browser"}),Error("RUM Profiler is not supported in this browser.");"running"===A.state&&j(A);const{cleanupTasks:i}=function(e){if("running"===e.state)return{cleanupTasks:e.cleanupTasks};const n=[],s=t.subscribe(2,e=>{const t={viewId:e.id,viewName:k(e.name,document.location.pathname),startClocks:e.startClocks};L(t),h=t});return n.push(s.unsubscribe),{cleanupTasks:n}}(A);let o;try{o=new e({sampleInterval:g.sampleIntervalMs,maxBufferSize:Math.round(1.5*g.collectIntervalMs/g.sampleIntervalMs)})}catch(e){return void(e instanceof Error&&e.message.includes("disabled by Document Policy")?(u.V.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",e),v.set({status:"error",error_reason:"missing-document-policy-header"})):v.set({status:"error",error_reason:"unexpected-exception"}))}v.set({status:"running",error_reason:void 0}),A={state:"running",startClocks:(0,a.M8)(),profiler:o,timeoutId:(0,d.wg)(N,g.collectIntervalMs),views:[],cleanupTasks:i,longTasks:[],sessionId:n.findTrackedSession()?.id},L(h),o.addEventListener("samplebufferfull",G)}function j(t){(0,d.DJ)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",G);const{startClocks:n,views:s,sessionId:i}=t;t.profiler.stop().then(t=>{const o=(0,a.M8)(),r=(0,a.vk)(n.relative,o.relative),l=T.findAll(n.relative,r),c=E.findAll(n.relative,r),u=S.findAll(n.relative,r).map(e=>({id:e.id,label:e.label,startClocks:e.startClocks,duration:e.duration})),d=r<g.minProfileDurationMs;0===l.length&&d||function(t,n){const s={profile:_(t,e,n),trace:t};w(s)}(Object.assign({},t,{startClocks:n,endClocks:o,clocksOrigin:(0,a.Oc)(),longTasks:l,actions:c,vitals:u,views:s,sampleInterval:g.sampleIntervalMs,debugIds:M(t.resources)}),i)}).catch(c.Dx)}function L(e){"running"===A.state&&e&&A.views.push(e)}function G(){N()}function B(){"hidden"===document.visibilityState&&"running"===A.state?function(){if("running"!==A.state)return;const e=A;A={state:"paused"},e.cleanupTasks.forEach(e=>e()),j(e)}():"visible"===document.visibilityState&&"paused"===A.state&&N()}function J(){N()}return t.subscribe(10,()=>{O("session-expired")}),t.subscribe(11,()=>{if("stopped"===A.state&&("session-expired"===A.stateReason||"quota_ko"===A.stateReason)){const t=n.findTrackedSession();if(!t||!(0,r.$5)(t.id,(0,r.it)(e.sessionSampleRate,e.profilingSampleRate)))return;x()}}),{start:x,stop(){O("stopped-by-user")},isStopped:()=>"stopped"===A.state,isRunning:()=>"running"===A.state,isPaused:()=>"paused"===A.state}}}};
|