@datadog/browser-rum-shopify 7.17.1 → 7.19.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/bundle/chunks/datadogProfiler-b6325f5590320ec70762-datadog-rum-shopify.js +1 -0
- package/bundle/chunks/{datadogRecorder-4ace47c1ea1f698b8e26-datadog-rum-shopify.js → datadogRecorder-aa30b860b1b5d59ebee0-datadog-rum-shopify.js} +1 -1
- package/bundle/datadog-rum-shopify.js +1 -1
- package/cjs/domain/shopifyAppPixelPlugin.d.ts +7 -0
- package/cjs/domain/shopifyAppPixelPlugin.js +24 -0
- package/cjs/domain/shopifyAppPixelPlugin.js.map +1 -0
- package/cjs/domain/shopifyPlugin.js +1 -1
- package/cjs/entries/main.js +2 -0
- package/cjs/entries/main.js.map +1 -1
- package/esm/domain/shopifyAppPixelPlugin.mjs +24 -0
- package/esm/domain/shopifyAppPixelPlugin.mjs.map +1 -0
- package/esm/domain/shopifyPlugin.mjs +1 -1
- package/esm/entries/main.mjs +2 -0
- package/esm/entries/main.mjs.map +1 -1
- package/package.json +5 -5
- package/src/domain/shopifyAppPixelPlugin.ts +22 -0
- package/src/entries/main.ts +6 -1
- package/bundle/chunks/datadogProfiler-69f13dc9a235dcd5b806-datadog-rum-shopify.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __webpack_esm_ids__=["datadogProfiler"];export const __webpack_esm_modules__={740(e,t,n){n.d(t,{createRumProfiler:()=>L});var r=n(5762),i=n(2128),s=n(8975),o=n(449),a=n(8333),l=n(9305),c=n(4215),d=n(5648),u=n(1e3),p=n(5358),f=n(5387);function v(e,t,n=5e3){const r=function(e,t){return(0,f.Hg)({proxy:e.proxy,site:e.site,path:"/api/v2/profiling/quota",parameters:"session_id="+t,subdomain:"quota"})}(e,t),i=new AbortController;let o;const a=(0,p.h)(r,{credentials:"omit",signal:i.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,s.DJ)(o),function(e,t){const n=e?.data?.attributes;if(!n||"boolean"!=typeof n.admitted||"string"!=typeof n.reason)return t;const r="backend_client_not_initialized"===n.reason?"backend_unavailable":n.reason;return{decision:n.admitted?"quota_ok":"quota_ko",reason:r}}(e,t)),()=>((0,s.DJ)(o),t))}).catch(()=>((0,s.DJ)(o),{decision:"quota_ok",reason:"api-error"})),l=new Promise(e=>{o=(0,s.wg)(()=>{i.abort(),e({decision:"quota_ok",reason:"timeout"})},n)});return Promise.race([a,l])}var m=n(603),b=n(2511),k=n(4822);const _=m.AQ;function g(e){const t=(0,b.qj)({expireDelay:_});return e.subscribe(12,({rawRumEvent:e,startClocks:n,duration:r})=>{"long_task"===e.type&&t.add({id:e.long_task.id,startClocks:n,duration:r,entryType:e.long_task.entry_type===k.K.LONG_TASK?k.do.LONG_TASK:k.do.LONG_ANIMATION_FRAME},n.relative).close((0,a.Gw)(n.relative,r))}),t}const y=m.AQ;function w(e){const t=(0,b.qj)({expireDelay:y});return e.subscribe(15,e=>{t.add({id:e.id,label:"",startClocks:e.startClocks,duration:void 0},e.startClocks.relative)}),e.subscribe(12,({rawRumEvent:e,startClocks:n,duration:r})=>{if("action"===e.type){const i=t.getEntries(n.relative).find(t=>t.value.id===e.action.id),s=r??0;i?(i.value.duration=s,i.close((0,a.Gw)(n.relative,s))):t.add({id:e.action.id,label:"",startClocks:n,duration:r},n.relative).close((0,a.Gw)(n.relative,s))}}),t}const h=m.AQ;function C(e){const t=(0,b.qj)({expireDelay:h});return e.subscribe(16,e=>{t.add({id:e.id,type:k.DL.DURATION,startClocks:e.startClocks,duration:void 0,label:e.name},e.startClocks.relative)}),e.subscribe(12,({rawRumEvent:e,startClocks:n,duration:r})=>{if("vital"!==e.type)return;if(e.vital.type===k.DL.WEBSOCKET)return;const i=e.vital;if(i.type===k.DL.OPERATION_STEP){if("start"===i.step_type)t.add({id:i.id,type:i.type,operationKey:i.operation_key,startClocks:n,label:i.name},n.relative);else if("end"===i.step_type){const e=t.findAllEntries().find(e=>e.value.type===k.DL.OPERATION_STEP&&e.value.label===i.name&&e.value.operationKey===i.operation_key);if(!e)return;e.value.duration=(0,a.vk)(e.value.startClocks.relative,n.relative),e.close(n.relative)}return}const s=t.getEntries(n.relative).find(e=>e.value.id===i.id);if(s)return s.value.duration=r,void s.close((0,a.Gw)(n.relative,r));t.add({id:i.id,type:i.type,operationKey:i.operation_key,startClocks:n,duration:r,label:i.name},n.relative).close((0,a.Gw)(n.relative,r))}),t}function I(e,t){const n=(0,b.qj)({expireDelay:m.AQ}),s=t.findView();function o(e){n.add({viewId:e.id,viewName:D(e.name,(0,r.B)(i.J.location).pathname),startClocks:e.startClocks},e.startClocks.relative)}return s&&o(s),e.subscribe(2,o),e.subscribe(6,({endClocks:e})=>{n.closeActive(e.relative)}),n}const D=(e,t)=>e||function(e){return e?e.replace(E,"/?"):"/"}(t),E=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g;var S=n(8032);function A(e){const t=new Map((0,S.Jv)(e)?.map(e=>[e.url,e.id])),n=[];return e.forEach((e,r)=>{const i=t.get(e);void 0!==i&&n.push({resourceId:r,debugId:i})}),n.length?n:void 0}var q=n(98);function T(e,t,n){const r=(0,q.m5)(t),i=function({views:e,longTasks:t,actions:n,vitals:r},i,s){const o=t.map(({id:e})=>e).filter(e=>void 0!==e),a=n?.map(({id:e})=>e)??[];return{application:{id:i},session:s?{id:s}:void 0,view:M(e),long_task:o.length?{id:o}:void 0,action:a.length?{id:a,label:[]}:void 0,vital:R(r)}}(e,t.applicationId,n),s=function(e){return e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}(r);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:s.join(","),_dd:{clock_drift:(0,a._O)()}}}function M(e){if(e.length)return{id:e.map(({viewId:e})=>e),name:Array.from(new Set(e.map(({viewName:e})=>e).filter(e=>!!e)))}}function R(e){if(e?.length)return{id:e.map(({id:e})=>e),label:Array.from(new Set(e.map(({label:e})=>e)))}}function x(){const e=(0,l.Y9)();return t=>{e.send("profile",t)}}function P(e,t,n){const r=(0,k.wP)(e,t,n,6);return({profile:e,trace:t})=>{const n={event:e,"wall-time.json":t};r.send(n)}}const O={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3};function L(e,t,n,p,f,m,b=O){const k=(0,l.d0)()?(0,r.B)(x)():(0,r.B)(P)(e,t,f),_=function(e,t,n,i,s){const o=(0,r.B)(g)(t),l=(0,r.B)(w)(t),c=(0,r.B)(C)(t),d=(0,r.B)(I)(t,n);return{assemble(t,n,r,u){const p=(0,a.vk)(n.relative,r.relative),f=d.findAll(n.relative,p).reverse(),v=o.findAll(n.relative,p),m=l.findAll(n.relative,p),b=c.findAll(n.relative,p).map(e=>({id:e.id,label:e.label,startClocks:e.startClocks,duration:e.duration})),k=p<i.minProfileDurationMs;if(0===v.length&&k)return;const _={...t,startClocks:n,endClocks:r,clocksOrigin:(0,a.Oc)(),longTasks:v,actions:m,vitals:b,views:f,sampleInterval:i.sampleIntervalMs,debugIds:A(t.resources)};s({profile:T(_,e,u),trace:_})}}}(e,t,m,b,k),y=[];let h={state:"stopped",stateReason:"initializing"},D=0;function E(){"running"!==h.state&&(y.push((0,o.q2)(window,"visibilitychange",L).stop,(0,o.q2)(window,"beforeunload",N).stop),q(),function(){if((0,l.d0)())return;const t=++D,i=n.findTrackedSession()?.id;i&&(0,r.B)(v)(e,i).then(e=>{t===D&&("running"!==h.state&&"paused"!==h.state||"quota_ko"===e.decision&&S("quota_ko",e.reason))}).catch(u.Dx)}())}function S(e,t){!function(e){if("running"!==h.state)return void(("paused"===h.state||"stopped"===h.state&&"stopped-by-user"===e)&&(h={state:"stopped",stateReason:e}));const t=h;h={state:"stopped",stateReason:e},"quota_ko"===e?((0,s.DJ)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",R),t.profiler.stop().catch(u.Dx)):M(t)}(e),y.forEach(e=>e()),y.length=0,p.set({status:"stopped",error_reason:void 0,quota_reason:t})}function q(){const e=i.J.Profiler;if(!e)throw p.set({status:"error",error_reason:"not-supported-by-browser"}),Error("RUM Profiler is not supported in this browser.");let t;"running"===h.state&&M(h);try{t=new e({sampleInterval:b.sampleIntervalMs,maxBufferSize:Math.round(1.5*b.collectIntervalMs/b.sampleIntervalMs)})}catch(e){return void(e instanceof Error&&e.message.includes("disabled by Document Policy")?(d.V.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",e),p.set({status:"error",error_reason:"missing-document-policy-header"})):p.set({status:"error",error_reason:"unexpected-exception"}))}p.set({status:"running",error_reason:void 0}),h={state:"running",startClocks:(0,a.M8)(),profiler:t,timeoutId:(0,s.wg)(q,b.collectIntervalMs),sessionId:n.findTrackedSession()?.id},t.addEventListener("samplebufferfull",R)}function M(e){(0,s.DJ)(e.timeoutId),e.profiler.removeEventListener("samplebufferfull",R);const{startClocks:t,sessionId:n}=e,r=(0,a.M8)();e.profiler.stop().then(e=>{_.assemble(e,t,r,n)}).catch(u.Dx)}function R(){q()}function L(){"hidden"===document.visibilityState&&"running"===h.state?function(){if("running"!==h.state)return;const e=h;h={state:"paused"},M(e)}():"visible"===document.visibilityState&&"paused"===h.state&&q()}function N(){q()}return t.subscribe(9,()=>{S("session-expired")}),t.subscribe(10,()=>{if("stopped"===h.state&&("session-expired"===h.stateReason||"quota_ko"===h.stateReason)){const t=n.findTrackedSession();if(!t||!(0,c.$5)(t.id,(0,c.it)(e.sessionSampleRate,e.profilingSampleRate)))return;E()}}),{start:E,stop(){S("stopped-by-user")},isStopped:()=>"stopped"===h.state,isRunning:()=>"running"===h.state,isPaused:()=>"paused"===h.state}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_ids__=["datadogRecorder"];export const __webpack_esm_modules__={8647(e,t,s){s.d(t,{startRecording:()=>y});var n=s(9360),o=s(4023),i=s(7003),a=s(1776),r=s(6448),c=s(9305),u=s(8333),d=s(5387),p=s(
|
|
1
|
+
export const __webpack_esm_ids__=["datadogRecorder"];export const __webpack_esm_modules__={8647(e,t,s){s.d(t,{startRecording:()=>y});var n=s(9360),o=s(4023),i=s(7003),a=s(1776),r=s(6448),c=s(9305),u=s(8333),d=s(5387),p=s(1447),l=s(8975),m=s(979),h=s(728);function f({context:e,creationReason:t,encoder:s}){let n=0;const o=e.view.id,i={start:1/0,end:-1/0,creation_reason:t,records_count:0,has_full_snapshot:!1,index_in_view:h.K_(o),source:"browser",...e},a=(0,p.CB)();return h.H5(o),{addRecord(e,t){i.start=Math.min(i.start,e.timestamp),i.end=Math.max(i.end,e.timestamp),i.records_count+=1,i.has_full_snapshot||(i.has_full_snapshot=e.type===m.ee.FullSnapshot||e.type===m.ee.Change&&0===i.index_in_view);const o=s.isEmpty?'{"records":[':",";s.write(o+JSON.stringify(e),e=>{n+=e,t(n)})},addStats(e){(0,p.BJ)(a,e)},flush(e){if(s.isEmpty)throw Error("Empty segment flushed");s.write(`],${JSON.stringify(i).slice(1)}\n`),s.finish(t=>{h.L7(i.view.id,t.rawBytesCount),e(i,a,t)})}}}function y(e,t,s,m,h,y,g,b){const _=[],w=t=>{e.notify(14,{error:{message:t,source:o.g.AGENT,startClocks:(0,u.M8)()}}),(0,i.A2)("Error reported to customer",{"error.message":t})},S=g||(0,a.sA)([(0,d.ns)(t,"replay")],w,6e4),x=b||(0,a.sA)([(0,d.ns)(t,"replay")],w,0);let E,R,D=n.l,C=n.l;const{unsubscribe:T}=e.subscribe(11,e=>{e!==r.y5.PAGE_TERMINATED&&C()});if(_.push(T),(0,c.d0)())({addRecord:E}=function(e){const t=(0,c.Y9)();return{addRecord(s){const n=e.findView();t.send("record",s,n.id)}}}(m)),R=n.l;else{const o=function(e,t,s,n,o,i){return function(e,o,i,a){let c={status:0,nextSegmentCreationReason:"init"};const{unsubscribe:u}=e.subscribe(2,()=>{p("view_change")}),{unsubscribe:d}=e.subscribe(11,e=>{e!==r.y5.PAGE_TERMINATED&&p(e)});function p(e){1===c.status&&(c.segment.flush((t,s,n)=>{const o=function(e,t,s,n){const o=new FormData;o.append("segment",new Blob([e],{type:"application/octet-stream"}),`${t.session.id}-${t.start}`);const i={raw_segment_size:n,compressed_segment_size:e.byteLength,...t},a=JSON.stringify(i);return o.append("event",new Blob([a],{type:"application/json"})),{data:o,bytesCount:e.byteLength,cssText:s.cssText,isFullSnapshot:0===t.index_in_view,rawSize:n,recordCount:t.records_count,serializationDuration:s.serializationDuration}}(n.output,t,s,n.rawBytesCount);(0,r.Kp)(e)&&e!==r.y5.HIDDEN?i.sendOnExit(o):i.send(o)}),(0,l.DJ)(c.expirationTimeoutId)),c="stop"!==e?{status:0,nextSegmentCreationReason:e}:{status:2}}return{addRecord(e){if(2!==c.status){if(0===c.status){const e=function(e,t,s){const n=t.findTrackedSession(),o=s.findView();if(n&&o)return{application:{id:e},session:{id:n.id},view:{id:o.id}}}(t.applicationId,s,n);if(!e)return;c={status:1,segment:f({encoder:a,context:e,creationReason:c.nextSegmentCreationReason}),expirationTimeoutId:(0,l.wg)(()=>{p("segment_duration_limit")},5e3)}}c.segment.addRecord(e,e=>{e>6e4&&p("segment_bytes_limit")})}},addStats(e){1===c.status&&c.segment.addStats(e)},stop(){p("stop"),u(),d()}}}(e,0,o,i)}(e,t,s,m,S,h);E=o.addRecord,R=o.addStats,_.push(o.stop);const a=function(e,t){if(!e.metricsEnabled)return{stop:n.l};const{unsubscribe:s}=t.subscribe(e=>{if("failure"===e.type||"queue-full"===e.type||"success"===e.type&&e.payload.isFullSnapshot){const o=(t=e.type,s=e.bandwidth,{cssText:{count:(n=e.payload).cssText.count,max:n.cssText.max,sum:n.cssText.sum},encoding:{fullSnapshot:"change",incrementalSnapshot:"change"},isFullSnapshot:n.isFullSnapshot,ongoingRequests:{count:s.ongoingRequestCount,totalSize:s.ongoingByteCount},recordCount:n.recordCount,result:t,serializationDuration:{count:n.serializationDuration.count,max:n.serializationDuration.max,sum:n.serializationDuration.sum},size:{compressed:n.bytesCount,raw:n.rawSize}});(0,i.Gk)("Segment network request metrics",{metrics:o})}var t,s,n});return{stop:s}}(y,S.observable);_.push(a.stop);const c=function(e,t,s){const n=new Set,o=new Map,{unsubscribe:i}=s.observable.subscribe(e=>{if("success"===e.type){const t=o.get(e.payload.hash);o.delete(e.payload.hash),t&&t.onDiscards.clear()}else if("queue-full"===e.type){const t=o.get(e.payload.hash);o.delete(e.payload.hash),t&&(n.delete(e.payload.hash),t.onDiscards.forEach(e=>e()))}}),{unsubscribe:a}=t.subscribe(11,e=>{(0,r.Kp)(e)&&e!==r.y5.HIDDEN&&e!==r.y5.PAGE_TERMINATED&&o.forEach(({payload:e})=>s.sendOnExit(e))});return{emitResource(t,i,a){if(n.has(t))return void(a&&o.get(t)?.onDiscards.add(a));n.add(t);const r=function(e,t,s){const n=new FormData;n.append("image",t,e);const o={application:{id:s},type:"resource"};return n.append("event",new Blob([JSON.stringify(o)],{type:"application/json"})),{data:n,bytesCount:t.size,hash:e}}(t,i,e),c={payload:r,onDiscards:new Set};a&&c.onDiscards.add(a),o.set(t,c),s.send(r)},stop(){i(),a(),o.clear(),n.clear()}}}(t.applicationId,e,x);D=c.emitResource,_.push(c.stop)}const v=(0,p.g1)({emitRecord:E,emitResource:D,emitStats:R,configuration:t,lifeCycle:e,viewHistory:m});return C=v.flushMutations,{stop(){v.flushMutations(),v.stop(),_.forEach(e=>e())}}}}};
|