@code.store/arcxp-sdk-ts
TypeScript icon, indicating that this package has built-in type declarations

4.31.0 • Public • Published

arcxp-sdk-ts

typescript

A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.

Installation

Install the package with:

npm i @code.store/arcxp-sdk-ts

Features

API

  • Author
  • Draft
  • Identity
  • IFX
  • Redirect
  • Migration Center
  • Sales
  • Site
  • Websked
  • Retail Events (WebSockets)
  • Content
  • Signing Service
  • PhotoCenter
  • Global Settings
  • Tags
Usage example
import { ArcAPI } from '@code.store/arcxp-sdk-ts';

const api = ArcAPI({
  credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
  maxRPS: 10,
});
const id = await api.Draft.generateId(Date.now().toString());

Content Elements

  • text
  • header
  • image
  • quote
  • interstitial_link
  • raw_html
  • gallery
  • list
  • link_list
  • jwPlayer
Usage example
import { ContentElement } from '@code.store/arcxp-sdk-ts';

const header = ContentElement.header('Header', 4);
const text = ContentElement.text('text');

Image migration example

import { ArcTypes, ArcAPI } from '@code.store/arcxp-sdk-ts';

const api = ArcAPI({
  credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
  maxRPS: 10,
});
const sourceImageId = 'sourceImageId';
const id = await api.Draft.generateId(sourceImageId);
const ans: ArcTypes.Story.AnImage = {
  _id: id,
  description: { basic: 'Description' },
  caption: 'Caption',
  subtitle: 'Subtitle',
  alt_text: 'Alt',
  type: 'image',
  version: '0.10.9',
  image_type: 'photograph',
  source: {
    name: 'codestore-arcxp-sdk-ts',
    system: 'codestore-arcxp-sdk-ts',
    source_id: sourceImageId,
  },
  additional_properties: {
    originalName: 'originalName',
    version: 0,
    originalUrl: 'https://picsum.photos/200',
    published: true,
  },
};

await api.MigrationCenter.postAns(
  {
    website: 'YOUR_WEBSITE',
    groupId: 'images',
    priority: 'historical',
  },
  {
    sourceId: sourceImageId,
    sourceType: 'image',
    ANS: ans,
  }
);

Changeset

npx changeset && npx changeset version

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @code.store/arcxp-sdk-ts

Weekly Downloads

79

Version

4.31.0

License

MIT

Unpacked Size

293 kB

Total Files

162

Last publish

Collaborators

  • ellankz
  • msadovyi
  • kyrylo_semenov
  • valcker