@adhese/sdk 1.0.2 → 1.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @adhese/sdk
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 43a682c: Revert accidental change of Promise.allSettled to Promise.all which can cause issuess when a request fails
8
+ - 5393373: Add fallback legacy d.ts file for older ts version with very limited types
9
+
3
10
  ## 1.0.2
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const logger = require("./logger/logger.cjs");
3
4
  function isPreviewMode() {
4
5
  return window.location.search.includes("adhesePreviewCreativeId");
5
6
  }
@@ -7,7 +8,12 @@ async function fetchAllUnrenderedSlots(slots) {
7
8
  const filteredSlots = slots.filter((slot) => !slot.lazyLoading && !slot.data);
8
9
  if (filteredSlots.length === 0)
9
10
  return;
10
- await Promise.all(filteredSlots.map((slot) => slot.request));
11
+ const results = await Promise.allSettled(filteredSlots.map((slot) => slot.request));
12
+ for (const [index, result] of results.entries()) {
13
+ if (result.status === "rejected") {
14
+ logger.logger.error(`Failed to fetch slot data for slot ${filteredSlots[index].name}`, result.reason);
15
+ }
16
+ }
11
17
  }
12
18
  exports.fetchAllUnrenderedSlots = fetchAllUnrenderedSlots;
13
19
  exports.isPreviewMode = isPreviewMode;
@@ -1 +1 @@
1
- {"version":3,"file":"main.utils.cjs","sources":["../../src/main.utils.ts"],"sourcesContent":["import type { AdheseSlot } from './slot/slot.types';\n\n/**\n * Checks if the current page is in preview mode.\n */\nexport function isPreviewMode(): boolean {\n return window.location.search.includes('adhesePreviewCreativeId');\n}\n\nexport async function fetchAllUnrenderedSlots(slots: ReadonlyArray<AdheseSlot>): Promise<void> {\n const filteredSlots = slots.filter(slot => !slot.lazyLoading && !slot.data);\n\n if (filteredSlots.length === 0)\n return;\n\n await Promise.all(filteredSlots.map(slot => slot.request));\n}\n"],"names":[],"mappings":";;AAKO,SAAS,gBAAyB;AACvC,SAAO,OAAO,SAAS,OAAO,SAAS,yBAAyB;AAClE;AAEA,eAAsB,wBAAwB,OAAiD;AACvF,QAAA,gBAAgB,MAAM,OAAO,CAAA,SAAQ,CAAC,KAAK,eAAe,CAAC,KAAK,IAAI;AAE1E,MAAI,cAAc,WAAW;AAC3B;AAEF,QAAM,QAAQ,IAAI,cAAc,IAAI,CAAQ,SAAA,KAAK,OAAO,CAAC;AAC3D;;;"}
1
+ {"version":3,"file":"main.utils.cjs","sources":["../../src/main.utils.ts"],"sourcesContent":["import type { AdheseSlot } from './slot/slot.types';\nimport { logger } from './logger/logger';\n\n/**\n * Checks if the current page is in preview mode.\n */\nexport function isPreviewMode(): boolean {\n return window.location.search.includes('adhesePreviewCreativeId');\n}\n\nexport async function fetchAllUnrenderedSlots(slots: ReadonlyArray<AdheseSlot>): Promise<void> {\n const filteredSlots = slots.filter(slot => !slot.lazyLoading && !slot.data);\n\n if (filteredSlots.length === 0)\n return;\n\n const results = await Promise.allSettled(filteredSlots.map(slot => slot.request));\n\n for (const [index, result] of results.entries()) {\n if (result.status === 'rejected') {\n logger.error(`Failed to fetch slot data for slot ${filteredSlots[index].name}`, result.reason);\n }\n }\n}\n"],"names":["logger"],"mappings":";;;AAMO,SAAS,gBAAyB;AACvC,SAAO,OAAO,SAAS,OAAO,SAAS,yBAAyB;AAClE;AAEA,eAAsB,wBAAwB,OAAiD;AACvF,QAAA,gBAAgB,MAAM,OAAO,CAAA,SAAQ,CAAC,KAAK,eAAe,CAAC,KAAK,IAAI;AAE1E,MAAI,cAAc,WAAW;AAC3B;AAEI,QAAA,UAAU,MAAM,QAAQ,WAAW,cAAc,IAAI,CAAA,SAAQ,KAAK,OAAO,CAAC;AAEhF,aAAW,CAAC,OAAO,MAAM,KAAK,QAAQ,WAAW;AAC3C,QAAA,OAAO,WAAW,YAAY;AACzBA,aAAAA,OAAA,MAAM,sCAAsC,cAAc,KAAK,EAAE,IAAI,IAAI,OAAO,MAAM;AAAA,IAC/F;AAAA,EACF;AACF;;;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const name = "@adhese/sdk";
4
- const version = "1.0.2";
4
+ const version = "1.0.3";
5
5
  exports.name = name;
6
6
  exports.version = version;
7
7
  //# sourceMappingURL=package.json.cjs.map
@@ -0,0 +1 @@
1
+ declare function createAdhese(options: any): any;
@@ -1,3 +1,4 @@
1
+ import { logger } from "./logger/logger.js";
1
2
  function isPreviewMode() {
2
3
  return window.location.search.includes("adhesePreviewCreativeId");
3
4
  }
@@ -5,7 +6,12 @@ async function fetchAllUnrenderedSlots(slots) {
5
6
  const filteredSlots = slots.filter((slot) => !slot.lazyLoading && !slot.data);
6
7
  if (filteredSlots.length === 0)
7
8
  return;
8
- await Promise.all(filteredSlots.map((slot) => slot.request));
9
+ const results = await Promise.allSettled(filteredSlots.map((slot) => slot.request));
10
+ for (const [index, result] of results.entries()) {
11
+ if (result.status === "rejected") {
12
+ logger.error(`Failed to fetch slot data for slot ${filteredSlots[index].name}`, result.reason);
13
+ }
14
+ }
9
15
  }
10
16
  export {
11
17
  fetchAllUnrenderedSlots,
@@ -1 +1 @@
1
- {"version":3,"file":"main.utils.js","sources":["../src/main.utils.ts"],"sourcesContent":["import type { AdheseSlot } from './slot/slot.types';\n\n/**\n * Checks if the current page is in preview mode.\n */\nexport function isPreviewMode(): boolean {\n return window.location.search.includes('adhesePreviewCreativeId');\n}\n\nexport async function fetchAllUnrenderedSlots(slots: ReadonlyArray<AdheseSlot>): Promise<void> {\n const filteredSlots = slots.filter(slot => !slot.lazyLoading && !slot.data);\n\n if (filteredSlots.length === 0)\n return;\n\n await Promise.all(filteredSlots.map(slot => slot.request));\n}\n"],"names":[],"mappings":"AAKO,SAAS,gBAAyB;AACvC,SAAO,OAAO,SAAS,OAAO,SAAS,yBAAyB;AAClE;AAEA,eAAsB,wBAAwB,OAAiD;AACvF,QAAA,gBAAgB,MAAM,OAAO,CAAA,SAAQ,CAAC,KAAK,eAAe,CAAC,KAAK,IAAI;AAE1E,MAAI,cAAc,WAAW;AAC3B;AAEF,QAAM,QAAQ,IAAI,cAAc,IAAI,CAAQ,SAAA,KAAK,OAAO,CAAC;AAC3D;"}
1
+ {"version":3,"file":"main.utils.js","sources":["../src/main.utils.ts"],"sourcesContent":["import type { AdheseSlot } from './slot/slot.types';\nimport { logger } from './logger/logger';\n\n/**\n * Checks if the current page is in preview mode.\n */\nexport function isPreviewMode(): boolean {\n return window.location.search.includes('adhesePreviewCreativeId');\n}\n\nexport async function fetchAllUnrenderedSlots(slots: ReadonlyArray<AdheseSlot>): Promise<void> {\n const filteredSlots = slots.filter(slot => !slot.lazyLoading && !slot.data);\n\n if (filteredSlots.length === 0)\n return;\n\n const results = await Promise.allSettled(filteredSlots.map(slot => slot.request));\n\n for (const [index, result] of results.entries()) {\n if (result.status === 'rejected') {\n logger.error(`Failed to fetch slot data for slot ${filteredSlots[index].name}`, result.reason);\n }\n }\n}\n"],"names":[],"mappings":";AAMO,SAAS,gBAAyB;AACvC,SAAO,OAAO,SAAS,OAAO,SAAS,yBAAyB;AAClE;AAEA,eAAsB,wBAAwB,OAAiD;AACvF,QAAA,gBAAgB,MAAM,OAAO,CAAA,SAAQ,CAAC,KAAK,eAAe,CAAC,KAAK,IAAI;AAE1E,MAAI,cAAc,WAAW;AAC3B;AAEI,QAAA,UAAU,MAAM,QAAQ,WAAW,cAAc,IAAI,CAAA,SAAQ,KAAK,OAAO,CAAC;AAEhF,aAAW,CAAC,OAAO,MAAM,KAAK,QAAQ,WAAW;AAC3C,QAAA,OAAO,WAAW,YAAY;AACzB,aAAA,MAAM,sCAAsC,cAAc,KAAK,EAAE,IAAI,IAAI,OAAO,MAAM;AAAA,IAC/F;AAAA,EACF;AACF;"}
@@ -1,5 +1,5 @@
1
1
  const name = "@adhese/sdk";
2
- const version = "1.0.2";
2
+ const version = "1.0.3";
3
3
  export {
4
4
  name,
5
5
  version
package/package.json CHANGED
@@ -1,16 +1,31 @@
1
1
  {
2
2
  "name": "@adhese/sdk",
3
3
  "type": "module",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "description": "Adhese SDK",
6
6
  "license": "GPL-3.0",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/adhese/sdk_typescript.git"
10
10
  },
11
+ "exports": [
12
+ {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs",
16
+ "types@<5.1": "./dist/legacy.d.ts"
17
+ }
18
+ ],
11
19
  "main": "./dist/index.cjs",
12
20
  "module": "./dist/index.js",
13
21
  "types": "./dist/index.d.ts",
22
+ "typesVersions": {
23
+ "<5.1": {
24
+ "*": [
25
+ "./dist/legacy.d.ts"
26
+ ]
27
+ }
28
+ },
14
29
  "files": [
15
30
  "CHANGELOG.md",
16
31
  "LICENSE",