How to use the @commercetools-frontend/constants.MC_API_PROXY_TARGETS.PIM_SEARCH function in @commercetools-frontend/constants

To help you get started, weā€™ve selected a few @commercetools-frontend/constants examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / merchant-center-application-kit / packages / application-shell / src / components / quick-access / quick-access.js View on Github external
getPimSearchStatus: () =>
      dispatch(
        // TODO this should be sdkActions.head()
        // and then we should check whether the response code is
        // - 200 meaning the project is indexed
        // - 404 meaning the project is not indexed
        //
        // But there is a problem in tne node-sdk client as it tries to
        // .json()-parse the response to HEAD requests which results in an
        // error, so we send a regular request for now and limit to no results
        // instead to keep the payload minimal
        sdkActions.post({
          uri: `/${ownProps.applicationContext.project.key}/search/products`,
          mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
          payload: {
            query: {
              fullText: {
                field: 'name',
                language: ownProps.applicationContext.dataLocale,
                value: 'availability-check',
              },
            },
            limit: 0,
            offset: 0,
          },
        })
      ).then(
        () => pimIndexerStates.INDEXED,
        // project is not using pim-indexer when response error code is 404,
        // but we treat all errors as non-indexed as a safe guard, so we're
github commercetools / merchant-center-application-kit / packages / application-shell / src / components / quick-access / quick-access.spec.js View on Github external
const createPimAvailabilityCheckSdkMock = (projectDataLocale = 'en') => ({
  action: {
    type: 'SDK',
    payload: {
      method: 'POST',
      uri: '/test-with-big-data/search/products',
      mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
      payload: {
        query: {
          fullText: {
            field: 'name',
            language: projectDataLocale,
            value: 'availability-check',
          },
        },
        limit: 0,
        offset: 0,
      },
    },
  },
  response: {},
});
github commercetools / merchant-center-application-kit / packages / application-shell / src / components / quick-access / quick-access.spec.js View on Github external
},
          },
        },
      ];
      const rendered = renderAppWithRedux(, {
        permissions: managePermissions,
        mocks,
        sdkMocks: [
          createPimAvailabilityCheckSdkMock(),
          {
            action: {
              type: 'SDK',
              payload: {
                method: 'POST',
                uri: '/test-with-big-data/search/products',
                mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
                payload: {
                  query: {
                    fullText: {
                      field: 'name',
                      language: 'en',
                      value: searchText,
                    },
                  },
                  sort: [{ field: 'name', language: 'en', order: 'desc' }],
                  limit: 9,
                  offset: 0,
                },
              },
            },
            response: {
              total: 1,
github commercetools / merchant-center-application-kit / packages / application-shell / src / components / quick-access / quick-access.js View on Github external
pimSearchProductIds: searchText =>
      dispatch(
        sdkActions.post({
          uri: `/${ownProps.applicationContext.project.key}/search/products`,
          mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
          payload: {
            query: {
              fullText: {
                field: 'name',
                language: ownProps.applicationContext.dataLocale,
                value: searchText,
              },
            },
            sort: [
              {
                field: 'name',
                language: ownProps.applicationContext.dataLocale,
                order: 'desc',
              },
            ],
            limit: 9,

@commercetools-frontend/constants

Shared constants for MC applications

MIT
Latest version published 25 days ago

Package Health Score

87 / 100
Full package analysis