@diffsome/sdk 3.2.2 → 3.2.6

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.mts CHANGED
@@ -11348,6 +11348,11 @@ declare class HttpClient {
11348
11348
  * Get the base URL with tenant path
11349
11349
  */
11350
11350
  getBaseUrl(): string;
11351
+ /**
11352
+ * Get the download URL for a digital file
11353
+ * Includes auth_token query parameter for authentication
11354
+ */
11355
+ getDownloadUrl(token: string): string;
11351
11356
  /**
11352
11357
  * Set cart session ID (for guest cart persistence)
11353
11358
  */
@@ -11899,10 +11904,10 @@ declare class ShopResource {
11899
11904
  getOrderDownloads(orderNumber: string): Promise<DigitalDownloadLink[]>;
11900
11905
  /**
11901
11906
  * Get download file URL
11902
- * Returns the direct download URL for the file
11903
- * Requires authentication
11907
+ * Returns the web download URL that handles server-side authentication
11908
+ * User must be logged in via session (not just API token)
11904
11909
  */
11905
- downloadFile(token: string): Promise<string>;
11910
+ getDownloadUrl(token: string): string;
11906
11911
  /**
11907
11912
  * Get download link info (without triggering download)
11908
11913
  * Requires authentication
package/dist/index.d.ts CHANGED
@@ -11348,6 +11348,11 @@ declare class HttpClient {
11348
11348
  * Get the base URL with tenant path
11349
11349
  */
11350
11350
  getBaseUrl(): string;
11351
+ /**
11352
+ * Get the download URL for a digital file
11353
+ * Includes auth_token query parameter for authentication
11354
+ */
11355
+ getDownloadUrl(token: string): string;
11351
11356
  /**
11352
11357
  * Set cart session ID (for guest cart persistence)
11353
11358
  */
@@ -11899,10 +11904,10 @@ declare class ShopResource {
11899
11904
  getOrderDownloads(orderNumber: string): Promise<DigitalDownloadLink[]>;
11900
11905
  /**
11901
11906
  * Get download file URL
11902
- * Returns the direct download URL for the file
11903
- * Requires authentication
11907
+ * Returns the web download URL that handles server-side authentication
11908
+ * User must be logged in via session (not just API token)
11904
11909
  */
11905
- downloadFile(token: string): Promise<string>;
11910
+ getDownloadUrl(token: string): string;
11906
11911
  /**
11907
11912
  * Get download link info (without triggering download)
11908
11913
  * Requires authentication
package/dist/index.js CHANGED
@@ -159,6 +159,17 @@ var HttpClient = class {
159
159
  getBaseUrl() {
160
160
  return `${this.baseUrl}/api/${this.tenantId}`;
161
161
  }
162
+ /**
163
+ * Get the download URL for a digital file
164
+ * Includes auth_token query parameter for authentication
165
+ */
166
+ getDownloadUrl(token) {
167
+ const url = `${this.baseUrl}/download/${this.tenantId}/${token}`;
168
+ if (this.token) {
169
+ return `${url}?auth_token=${encodeURIComponent(this.token)}`;
170
+ }
171
+ return url;
172
+ }
162
173
  /**
163
174
  * Set cart session ID (for guest cart persistence)
164
175
  */
@@ -1134,11 +1145,11 @@ var ShopResource = class {
1134
1145
  }
1135
1146
  /**
1136
1147
  * Get download file URL
1137
- * Returns the direct download URL for the file
1138
- * Requires authentication
1148
+ * Returns the web download URL that handles server-side authentication
1149
+ * User must be logged in via session (not just API token)
1139
1150
  */
1140
- async downloadFile(token) {
1141
- return `${this.http.getBaseUrl()}/downloads/${token}`;
1151
+ getDownloadUrl(token) {
1152
+ return this.http.getDownloadUrl(token);
1142
1153
  }
1143
1154
  /**
1144
1155
  * Get download link info (without triggering download)
package/dist/index.mjs CHANGED
@@ -129,6 +129,17 @@ var HttpClient = class {
129
129
  getBaseUrl() {
130
130
  return `${this.baseUrl}/api/${this.tenantId}`;
131
131
  }
132
+ /**
133
+ * Get the download URL for a digital file
134
+ * Includes auth_token query parameter for authentication
135
+ */
136
+ getDownloadUrl(token) {
137
+ const url = `${this.baseUrl}/download/${this.tenantId}/${token}`;
138
+ if (this.token) {
139
+ return `${url}?auth_token=${encodeURIComponent(this.token)}`;
140
+ }
141
+ return url;
142
+ }
132
143
  /**
133
144
  * Set cart session ID (for guest cart persistence)
134
145
  */
@@ -1104,11 +1115,11 @@ var ShopResource = class {
1104
1115
  }
1105
1116
  /**
1106
1117
  * Get download file URL
1107
- * Returns the direct download URL for the file
1108
- * Requires authentication
1118
+ * Returns the web download URL that handles server-side authentication
1119
+ * User must be logged in via session (not just API token)
1109
1120
  */
1110
- async downloadFile(token) {
1111
- return `${this.http.getBaseUrl()}/downloads/${token}`;
1121
+ getDownloadUrl(token) {
1122
+ return this.http.getDownloadUrl(token);
1112
1123
  }
1113
1124
  /**
1114
1125
  * Get download link info (without triggering download)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffsome/sdk",
3
- "version": "3.2.2",
3
+ "version": "3.2.6",
4
4
  "description": "Diffsome SDK for JavaScript/TypeScript - Different + Awesome",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",