@code.store/arcxp-sdk-ts 4.1.1 → 4.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.
@@ -1,5 +1,7 @@
1
1
  import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
2
+ import { CreateDocumentRedirectPayload, CreateExternalRedirectPayload, CreateRedirectPayload, DocumentRedirect, ExternalRedirect } from './types';
2
3
  export declare class ArcDraft extends ArcAbstractAPI {
3
4
  constructor(options: ArcAPIOptions);
4
5
  generateId(id: string): Promise<string>;
6
+ createRedirect<P extends CreateRedirectPayload, R = P extends CreateExternalRedirectPayload ? ExternalRedirect : P extends CreateDocumentRedirectPayload ? DocumentRedirect : never>(website: string, websiteUrl: string, payload: P): Promise<R>;
5
7
  }
@@ -10,6 +10,10 @@ class ArcDraft extends abstract_api_1.ArcAbstractAPI {
10
10
  const { data } = await this.client.get('/arcuuid', { params: { id } });
11
11
  return data.id;
12
12
  }
13
+ async createRedirect(website, websiteUrl, payload) {
14
+ const { data } = await this.client.post(`/redirect/${website}/${websiteUrl}`, payload);
15
+ return data;
16
+ }
13
17
  }
14
18
  exports.ArcDraft = ArcDraft;
15
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/draft/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAEhE,MAAa,QAAS,SAAQ,6BAAc;IAC1C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AATD,4BASC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/draft/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAShE,MAAa,QAAS,SAAQ,6BAAc;IAC1C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc,CAOlB,OAAe,EAAE,UAAkB,EAAE,OAAU;QAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAI,aAAa,OAAO,IAAI,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QAC1F,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArBD,4BAqBC"}
@@ -1 +1,22 @@
1
+ export type CreateExternalRedirectPayload = {
2
+ redirect_to: string;
3
+ document_id?: undefined;
4
+ };
5
+ export type CreateDocumentRedirectPayload = {
6
+ document_id: string;
7
+ redirect_to?: undefined;
8
+ };
9
+ export type CreateRedirectPayload = CreateDocumentRedirectPayload | CreateExternalRedirectPayload;
10
+ type BaseRedirectData = {
11
+ website_id: string;
12
+ website_url: string;
13
+ created_at: string;
14
+ updated_at: string;
15
+ };
16
+ export type DocumentRedirect = {
17
+ document_id: string;
18
+ } & BaseRedirectData;
19
+ export type ExternalRedirect = {
20
+ redirect_to: string;
21
+ } & BaseRedirectData;
1
22
  export {};
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ArcAPI } from './api';
2
2
  import { ContentElement, ContentElementType } from './content-elements';
3
3
  import { WsClient } from './api/ws.client';
4
+ import { ArcError } from './api/error';
4
5
  import * as ArcTypes from './types';
5
6
  export * from './api/identity/types';
6
7
  export * from './api/draft/types';
@@ -10,4 +11,4 @@ export * from './api/migration-center/types';
10
11
  export * from './api/sales/types';
11
12
  export * from './api/websked/types';
12
13
  export * from './api/content/types';
13
- export { ArcAPI, WsClient, ContentElement, ContentElementType, ArcTypes };
14
+ export { ArcAPI, WsClient, ContentElement, ContentElementType, ArcTypes, ArcError };
package/dist/index.js CHANGED
@@ -26,13 +26,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ArcTypes = exports.ContentElement = exports.WsClient = exports.ArcAPI = void 0;
29
+ exports.ArcError = exports.ArcTypes = exports.ContentElement = exports.WsClient = exports.ArcAPI = void 0;
30
30
  const api_1 = require("./api");
31
31
  Object.defineProperty(exports, "ArcAPI", { enumerable: true, get: function () { return api_1.ArcAPI; } });
32
32
  const content_elements_1 = require("./content-elements");
33
33
  Object.defineProperty(exports, "ContentElement", { enumerable: true, get: function () { return content_elements_1.ContentElement; } });
34
34
  const ws_client_1 = require("./api/ws.client");
35
35
  Object.defineProperty(exports, "WsClient", { enumerable: true, get: function () { return ws_client_1.WsClient; } });
36
+ const error_1 = require("./api/error");
37
+ Object.defineProperty(exports, "ArcError", { enumerable: true, get: function () { return error_1.ArcError; } });
36
38
  const ArcTypes = __importStar(require("./types"));
37
39
  exports.ArcTypes = ArcTypes;
38
40
  __exportStar(require("./api/identity/types"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AActB,uFAdA,YAAM,OAcA;AAbf,yDAAwE;AAa7C,+FAblB,iCAAc,OAakB;AAZzC,+CAA2C;AAY1B,yFAZR,oBAAQ,OAYQ;AAXzB,kDAAoC;AAW2B,4BAAQ;AATvE,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAetB,uFAfA,YAAM,OAeA;AAdf,yDAAwE;AAc7C,+FAdlB,iCAAc,OAckB;AAbzC,+CAA2C;AAa1B,yFAbR,oBAAQ,OAaQ;AAZzB,uCAAuC;AAYkC,yFAZhE,gBAAQ,OAYgE;AAXjF,kDAAoC;AAW2B,4BAAQ;AATvE,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code.store/arcxp-sdk-ts",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",