@trycourier/courier-js 1.3.0 → 1.4.2

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/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ type CourierOptions = {
8
8
  };
9
9
  type PreferenceLinkOptions = {
10
10
  brandId?: string;
11
+ tenantId?: string;
11
12
  };
12
13
  declare class Courier {
13
14
  private authorization?;
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
27
  // package.json
28
- var version = "1.3.0";
28
+ var version = "1.4.2";
29
29
 
30
30
  // src/helpers/decode.ts
31
31
  function decode(clientKey) {
@@ -122,7 +122,7 @@ var Courier = class {
122
122
  }
123
123
  const id = decode(this.clientKey);
124
124
  return `https://view.notificationcenter.app/p/${encode(
125
- `${id}#${(_a = options == null ? void 0 : options.brandId) != null ? _a : ""}#${userId}#${false}`
125
+ `${id}#${(_a = options == null ? void 0 : options.brandId) != null ? _a : ""}#${userId}${(options == null ? void 0 : options.tenantId) ? `#${options.tenantId}` : ""}#${false}`
126
126
  )}`;
127
127
  }
128
128
  getPathURL(path, useClientPath) {
@@ -166,7 +166,7 @@ var client = {
166
166
  if (!event) {
167
167
  throw new Error("event is required");
168
168
  }
169
- let indempotentKey = self.crypto.randomUUID();
169
+ let indempotentKey = self.crypto.randomUUID ? self.crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
170
170
  await this.instance.post(`/inbound/courier`, {
171
171
  messageId: indempotentKey,
172
172
  type: "track",
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "1.3.0";
2
+ var version = "1.4.2";
3
3
 
4
4
  // src/helpers/decode.ts
5
5
  function decode(clientKey) {
@@ -96,7 +96,7 @@ var Courier = class {
96
96
  }
97
97
  const id = decode(this.clientKey);
98
98
  return `https://view.notificationcenter.app/p/${encode(
99
- `${id}#${(_a = options == null ? void 0 : options.brandId) != null ? _a : ""}#${userId}#${false}`
99
+ `${id}#${(_a = options == null ? void 0 : options.brandId) != null ? _a : ""}#${userId}${(options == null ? void 0 : options.tenantId) ? `#${options.tenantId}` : ""}#${false}`
100
100
  )}`;
101
101
  }
102
102
  getPathURL(path, useClientPath) {
@@ -140,7 +140,7 @@ var client = {
140
140
  if (!event) {
141
141
  throw new Error("event is required");
142
142
  }
143
- let indempotentKey = self.crypto.randomUUID();
143
+ let indempotentKey = self.crypto.randomUUID ? self.crypto.randomUUID() : Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
144
144
  await this.instance.post(`/inbound/courier`, {
145
145
  messageId: indempotentKey,
146
146
  type: "track",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier-js",
3
- "version": "1.3.0",
3
+ "version": "1.4.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "eslint": "^7.32.0",
14
14
  "tsup": "^5.10.1",
15
15
  "typescript": "^4.5.3",
16
- "@trycourier/tsconfig": "1.0.0",
17
- "eslint-config-courier": "1.0.0"
16
+ "eslint-config-courier": "1.0.0",
17
+ "@trycourier/tsconfig": "1.0.0"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"