@shipeasy/sdk 2.1.14 → 2.2.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.
@@ -124,6 +124,12 @@ interface ShipeasyClientConfig {
124
124
  * avoid the initial anon /sdk/evaluate round-trip.
125
125
  */
126
126
  autoIdentify?: boolean;
127
+ /**
128
+ * Capture web vitals (LCP, CLS, INP, TTFB, FCP) and JS/network errors as
129
+ * `__auto_*` metric events. Defaults to false (opt-in) — enabling requires the
130
+ * `__auto_*` event names to be approved in the project event catalog.
131
+ */
132
+ autoCollect?: boolean;
127
133
  }
128
134
  /**
129
135
  * Initialise the ShipEasy client SDK and wire up lazy devtools.
@@ -124,6 +124,12 @@ interface ShipeasyClientConfig {
124
124
  * avoid the initial anon /sdk/evaluate round-trip.
125
125
  */
126
126
  autoIdentify?: boolean;
127
+ /**
128
+ * Capture web vitals (LCP, CLS, INP, TTFB, FCP) and JS/network errors as
129
+ * `__auto_*` metric events. Defaults to false (opt-in) — enabling requires the
130
+ * `__auto_*` event names to be approved in the project event catalog.
131
+ */
132
+ autoCollect?: boolean;
127
133
  }
128
134
  /**
129
135
  * Initialise the ShipEasy client SDK and wire up lazy devtools.
@@ -410,7 +410,7 @@ var FlagsClientBrowser = class {
410
410
  this.sdkKey = opts.sdkKey;
411
411
  this.baseUrl = (opts.baseUrl ?? "https://edge.shipeasy.dev").replace(/\/$/, "");
412
412
  this.env = opts.env ?? "prod";
413
- this.autoGuardrails = opts.autoGuardrails !== false;
413
+ this.autoGuardrails = opts.autoGuardrails === true;
414
414
  this.anonId = getOrCreateAnonId();
415
415
  this.buffer = new EventBuffer(`${this.baseUrl}/collect`, this.sdkKey);
416
416
  void this.buffer.flushPendingAlias();
@@ -659,7 +659,8 @@ var _client = null;
659
659
  function shipeasy(opts) {
660
660
  const client = configureShipeasy({
661
661
  sdkKey: opts.apiKey,
662
- baseUrl: opts.baseUrl ?? "https://cdn.shipeasy.ai"
662
+ baseUrl: opts.baseUrl ?? "https://cdn.shipeasy.ai",
663
+ autoGuardrails: opts.autoCollect === true
663
664
  });
664
665
  flags.notifyMounted();
665
666
  if (opts.autoIdentify !== false) {
@@ -367,7 +367,7 @@ var FlagsClientBrowser = class {
367
367
  this.sdkKey = opts.sdkKey;
368
368
  this.baseUrl = (opts.baseUrl ?? "https://edge.shipeasy.dev").replace(/\/$/, "");
369
369
  this.env = opts.env ?? "prod";
370
- this.autoGuardrails = opts.autoGuardrails !== false;
370
+ this.autoGuardrails = opts.autoGuardrails === true;
371
371
  this.anonId = getOrCreateAnonId();
372
372
  this.buffer = new EventBuffer(`${this.baseUrl}/collect`, this.sdkKey);
373
373
  void this.buffer.flushPendingAlias();
@@ -616,7 +616,8 @@ var _client = null;
616
616
  function shipeasy(opts) {
617
617
  const client = configureShipeasy({
618
618
  sdkKey: opts.apiKey,
619
- baseUrl: opts.baseUrl ?? "https://cdn.shipeasy.ai"
619
+ baseUrl: opts.baseUrl ?? "https://cdn.shipeasy.ai",
620
+ autoGuardrails: opts.autoCollect === true
620
621
  });
621
622
  flags.notifyMounted();
622
623
  if (opts.autoIdentify !== false) {
@@ -539,7 +539,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
539
539
  if (i18nData) payload.i18n = i18nData;
540
540
  if (opts.editLabels) payload.editLabels = true;
541
541
  parts.push(
542
- `(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
542
+ `(function(){var Q=new URLSearchParams(location.search).has('se_edit_labels');var C=/(?:^|;\\s*)se_edit_labels=1(?:;|$)/.test(document.cookie);if(!Q&&!C)return;if(Q){try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
543
543
  );
544
544
  parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
545
545
  if (i18nData?.strings && Object.keys(i18nData.strings).length > 0) {
@@ -496,7 +496,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
496
496
  if (i18nData) payload.i18n = i18nData;
497
497
  if (opts.editLabels) payload.editLabels = true;
498
498
  parts.push(
499
- `(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
499
+ `(function(){var Q=new URLSearchParams(location.search).has('se_edit_labels');var C=/(?:^|;\\s*)se_edit_labels=1(?:;|$)/.test(document.cookie);if(!Q&&!C)return;if(Q){try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
500
500
  );
501
501
  parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
502
502
  if (i18nData?.strings && Object.keys(i18nData.strings).length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipeasy/sdk",
3
- "version": "2.1.14",
3
+ "version": "2.2.0",
4
4
  "description": "Shipeasy SDK — feature gates, runtime configs, experiments, and metrics for the Shipeasy hosted service.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://shipeasy.ai",