From 2ea6ca0672c9599a83f67c6fbf92d408708790e5 Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Thu, 15 Feb 2024 15:35:25 +0200 Subject: [PATCH 1/3] Update version --- package.json | 2 +- src/version.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index edf2ff8..40b2747 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sharetribe-flex-sdk", - "version": "1.20.0", + "version": "1.20.1", "description": "Sharetribe SDK for JavaScript", "main": "build/sharetribe-flex-sdk-node.js", "browser": "build/sharetribe-flex-sdk-web.js", diff --git a/src/version.js b/src/version.js index f919c82..914c5ba 100644 --- a/src/version.js +++ b/src/version.js @@ -1,3 +1,3 @@ // Update this when updating package.json -const sdkVersion = '1.20.0'; +const sdkVersion = '1.20.1'; export default sdkVersion; From c14c1715530281727fa6520233b331ba16110460 Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Thu, 15 Feb 2024 15:35:42 +0200 Subject: [PATCH 2/3] Build --- build/sharetribe-flex-sdk-node.js | 296 ++++++++++++++---------------- build/sharetribe-flex-sdk-web.js | 6 +- 2 files changed, 141 insertions(+), 161 deletions(-) diff --git a/build/sharetribe-flex-sdk-node.js b/build/sharetribe-flex-sdk-node.js index c509a49..9910de3 100644 --- a/build/sharetribe-flex-sdk-node.js +++ b/build/sharetribe-flex-sdk-node.js @@ -11638,159 +11638,6 @@ function () { }(); -// CONCATENATED MODULE: ./src/interceptors/add_idp_client_id_to_params.js -function add_idp_client_id_to_params_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function add_idp_client_id_to_params_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { add_idp_client_id_to_params_ownKeys(source, true).forEach(function (key) { add_idp_client_id_to_params_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { add_idp_client_id_to_params_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function add_idp_client_id_to_params_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function add_idp_client_id_to_params_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = add_idp_client_id_to_params_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } - -function add_idp_client_id_to_params_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } - -function add_idp_client_id_to_params_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function add_idp_client_id_to_params_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function add_idp_client_id_to_params_createClass(Constructor, protoProps, staticProps) { if (protoProps) add_idp_client_id_to_params_defineProperties(Constructor.prototype, protoProps); if (staticProps) add_idp_client_id_to_params_defineProperties(Constructor, staticProps); return Constructor; } - -/** - Read `idpClientId` from `ctx` and add it to `params` - - Changes to `ctx`: - - - add `params.idpClientId` - */ -var AddIdpClientIdToParams = -/*#__PURE__*/ -function () { - function AddIdpClientIdToParams() { - add_idp_client_id_to_params_classCallCheck(this, AddIdpClientIdToParams); - } - - add_idp_client_id_to_params_createClass(AddIdpClientIdToParams, [{ - key: "enter", - value: function enter(_ref) { - var params = _ref.params, - ctx = add_idp_client_id_to_params_objectWithoutProperties(_ref, ["params"]); - - var idpClientId = params.idpClientId; - return add_idp_client_id_to_params_objectSpread({}, ctx, { - idpClientId: idpClientId, - params: add_idp_client_id_to_params_objectSpread({}, params, { - idp_client_id: idpClientId - }) - }); - } - }]); - - return AddIdpClientIdToParams; -}(); - - -// CONCATENATED MODULE: ./src/interceptors/add_idp_id_to_params.js -function add_idp_id_to_params_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function add_idp_id_to_params_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { add_idp_id_to_params_ownKeys(source, true).forEach(function (key) { add_idp_id_to_params_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { add_idp_id_to_params_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function add_idp_id_to_params_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function add_idp_id_to_params_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = add_idp_id_to_params_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } - -function add_idp_id_to_params_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } - -function add_idp_id_to_params_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function add_idp_id_to_params_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function add_idp_id_to_params_createClass(Constructor, protoProps, staticProps) { if (protoProps) add_idp_id_to_params_defineProperties(Constructor.prototype, protoProps); if (staticProps) add_idp_id_to_params_defineProperties(Constructor, staticProps); return Constructor; } - -/** - Read `idpId` from `ctx` and add it to `params` - - Changes to `ctx`: - - - add `params.idpId` - */ -var AddIdpIdToParams = -/*#__PURE__*/ -function () { - function AddIdpIdToParams() { - add_idp_id_to_params_classCallCheck(this, AddIdpIdToParams); - } - - add_idp_id_to_params_createClass(AddIdpIdToParams, [{ - key: "enter", - value: function enter(_ref) { - var params = _ref.params, - ctx = add_idp_id_to_params_objectWithoutProperties(_ref, ["params"]); - - var idpId = params.idpId; - return add_idp_id_to_params_objectSpread({}, ctx, { - idpId: idpId, - params: add_idp_id_to_params_objectSpread({}, params, { - idp_id: idpId - }) - }); - } - }]); - - return AddIdpIdToParams; -}(); - - -// CONCATENATED MODULE: ./src/interceptors/add_idp_token_to_params.js -function add_idp_token_to_params_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function add_idp_token_to_params_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { add_idp_token_to_params_ownKeys(source, true).forEach(function (key) { add_idp_token_to_params_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { add_idp_token_to_params_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function add_idp_token_to_params_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function add_idp_token_to_params_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = add_idp_token_to_params_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } - -function add_idp_token_to_params_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } - -function add_idp_token_to_params_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function add_idp_token_to_params_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function add_idp_token_to_params_createClass(Constructor, protoProps, staticProps) { if (protoProps) add_idp_token_to_params_defineProperties(Constructor.prototype, protoProps); if (staticProps) add_idp_token_to_params_defineProperties(Constructor, staticProps); return Constructor; } - -/** - Read `idpToken` from `ctx` and add it to `params` - - Changes to `ctx`: - - - add `params.idpToken` - */ -var AddIdpTokenToParams = -/*#__PURE__*/ -function () { - function AddIdpTokenToParams() { - add_idp_token_to_params_classCallCheck(this, AddIdpTokenToParams); - } - - add_idp_token_to_params_createClass(AddIdpTokenToParams, [{ - key: "enter", - value: function enter(_ref) { - var params = _ref.params, - ctx = add_idp_token_to_params_objectWithoutProperties(_ref, ["params"]); - - var idpToken = params.idpToken; - return add_idp_token_to_params_objectSpread({}, ctx, { - idpToken: idpToken, - params: add_idp_token_to_params_objectSpread({}, params, { - idp_token: idpToken - }) - }); - } - }]); - - return AddIdpTokenToParams; -}(); - - // CONCATENATED MODULE: ./src/interceptors/add_subject_token_to_params.js function add_subject_token_to_params_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } @@ -12745,13 +12592,78 @@ function () { }(); +// CONCATENATED MODULE: ./src/interceptors/rename_idp_params_for_auth.js +function rename_idp_params_for_auth_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function rename_idp_params_for_auth_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { rename_idp_params_for_auth_ownKeys(source, true).forEach(function (key) { rename_idp_params_for_auth_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { rename_idp_params_for_auth_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function rename_idp_params_for_auth_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function rename_idp_params_for_auth_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = rename_idp_params_for_auth_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } + +function rename_idp_params_for_auth_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function rename_idp_params_for_auth_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function rename_idp_params_for_auth_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function rename_idp_params_for_auth_createClass(Constructor, protoProps, staticProps) { if (protoProps) rename_idp_params_for_auth_defineProperties(Constructor.prototype, protoProps); if (staticProps) rename_idp_params_for_auth_defineProperties(Constructor, staticProps); return Constructor; } + +/** + Renames IdP related auth parameters to use snake case. + + Changes to `ctx`: + + Update following param names, if they exist: + + - change `ctx.params.idpId` to `ctx.params.idp_id` + - change `ctx.params.idpClientId` to `ctx.params.idp_client_id` + - change `ctx.params.idpToken` to `ctx.params.idp_token` +*/ +var RenameIdpParamsForAuth = +/*#__PURE__*/ +function () { + function RenameIdpParamsForAuth() { + rename_idp_params_for_auth_classCallCheck(this, RenameIdpParamsForAuth); + } + + rename_idp_params_for_auth_createClass(RenameIdpParamsForAuth, [{ + key: "enter", + value: function enter(_ref) { + var params = _ref.params, + ctx = rename_idp_params_for_auth_objectWithoutProperties(_ref, ["params"]); + + var idpId = params.idpId, + idpClientId = params.idpClientId, + idpToken = params.idpToken, + rest = rename_idp_params_for_auth_objectWithoutProperties(params, ["idpId", "idpClientId", "idpToken"]); + + var idpIdObj = idpId ? { + idp_id: idpId + } : null; + var idpClientIdObj = idpClientId ? { + idp_client_id: idpClientId + } : null; + var idpTokenObj = idpToken ? { + idp_token: idpToken + } : null; + return rename_idp_params_for_auth_objectSpread({}, ctx, { + params: rename_idp_params_for_auth_objectSpread({}, idpIdObj, {}, idpClientIdObj, {}, idpTokenObj, {}, rest) + }); + } + }]); + + return RenameIdpParamsForAuth; +}(); + + // EXTERNAL MODULE: external "axios" var external_axios_ = __webpack_require__(72); var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_); // CONCATENATED MODULE: ./src/version.js // Update this when updating package.json -var sdkVersion = '1.20.0'; +var sdkVersion = '1.20.1'; /* harmony default export */ var src_version = (sdkVersion); // CONCATENATED MODULE: ./src/runtime.js @@ -13090,8 +13002,6 @@ function sdk_defineProperty(obj, key, value) { if (key in obj) { Object.definePr - - @@ -13204,7 +13114,7 @@ var authenticateInterceptors = [new FetchAuthTokenFromStore(), new fetch_auth_to var loginInterceptors = [new AddClientIdToParams(), new AddGrantTypeToParams(), new AddScopeToParams(), new SaveToken(), new AddAuthTokenResponse()]; var logoutInterceptors = [new FetchAuthTokenFromStore(), new clear_token_after_revoke_ClearTokenAfterRevoke(), new retry_with_refresh_token_RetryWithRefreshToken(), new AddAuthHeader(), new FetchRefreshTokenForRevoke()]; var exchangeTokenInterceptors = [new FetchAuthTokenFromStore(), new retry_with_refresh_token_RetryWithRefreshToken(), new AddClientIdToParams(), new AddClientSecretToParams(), new AddSubjectTokenToParams(), new AddTokenExchangeGrantTypeToParams()]; -var authWithIdpInterceptors = [new AddClientIdToParams(), new AddClientSecretToParams(), new AddIdpClientIdToParams(), new AddIdpIdToParams(), new AddIdpTokenToParams(), new SaveToken(), new AddAuthTokenResponse()]; +var sdk_authWithIdpInterceptors = [new AddClientIdToParams(), new AddClientSecretToParams(), new RenameIdpParamsForAuth(), new SaveToken(), new AddAuthTokenResponse()]; var sdk_allowedPerRequestOpts = function allowedPerRequestOpts(opts) { return pick_default()(opts, ['onUploadProgress']); @@ -13327,7 +13237,7 @@ var sdk_authApiSdkFns = function authApiSdkFns(authApiEndpointInterceptors, ctx) path: 'loginWithIdp', fn: sdk_createAuthApiSdkFn({ ctx: ctx, - interceptors: [].concat(authWithIdpInterceptors, sdk_toConsumableArray(get_default()(authApiEndpointInterceptors, 'authWithIdp'))) + interceptors: [].concat(sdk_authWithIdpInterceptors, sdk_toConsumableArray(get_default()(authApiEndpointInterceptors, 'authWithIdp'))) }) }]; }; @@ -13944,6 +13854,61 @@ function () { }(); +// CONCATENATED MODULE: ./src/interceptors/add_multitenant_auth_with_idp_response.js +function add_multitenant_auth_with_idp_response_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function add_multitenant_auth_with_idp_response_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { add_multitenant_auth_with_idp_response_ownKeys(source, true).forEach(function (key) { add_multitenant_auth_with_idp_response_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { add_multitenant_auth_with_idp_response_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function add_multitenant_auth_with_idp_response_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function add_multitenant_auth_with_idp_response_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function add_multitenant_auth_with_idp_response_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function add_multitenant_auth_with_idp_response_createClass(Constructor, protoProps, staticProps) { if (protoProps) add_multitenant_auth_with_idp_response_defineProperties(Constructor.prototype, protoProps); if (staticProps) add_multitenant_auth_with_idp_response_defineProperties(Constructor, staticProps); return Constructor; } + +/** + Take token data from `res` and add it to `ctx` top-level. + Make sure to include only the necessary keys. + + Changes to `ctx`: + + - add `authToken` +*/ +var AddMultitenantAuthWithIdpResponse = +/*#__PURE__*/ +function () { + function AddMultitenantAuthWithIdpResponse() { + add_multitenant_auth_with_idp_response_classCallCheck(this, AddMultitenantAuthWithIdpResponse); + } + + add_multitenant_auth_with_idp_response_createClass(AddMultitenantAuthWithIdpResponse, [{ + key: "leave", + + /* eslint camelcase: "off" */ + value: function leave(ctx) { + var _ctx$res$data = ctx.res.data, + access_token = _ctx$res$data.access_token, + refresh_token = _ctx$res$data.refresh_token, + token_type = _ctx$res$data.token_type, + expires_in = _ctx$res$data.expires_in, + scope = _ctx$res$data.scope; + return add_multitenant_auth_with_idp_response_objectSpread({}, ctx, { + authToken: { + access_token: access_token, + refresh_token: refresh_token, + token_type: token_type, + expires_in: expires_in, + scope: scope + } + }); + } + }]); + + return AddMultitenantAuthWithIdpResponse; +}(); + + // CONCATENATED MODULE: ./src/multitenant_sdk.js @@ -13983,6 +13948,8 @@ function multitenant_sdk_arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for + + /* eslint-disable class-methods-use-this */ var multitenant_sdk_defaultSdkConfig = { @@ -14000,6 +13967,9 @@ var multitenantAuthApi = [{ }, { path: 'client_data', method: 'get' +}, { + path: 'auth_with_idp', + method: 'post' }]; var multitenant_sdk_apis = { auth: function auth(_ref) { @@ -14064,6 +14034,10 @@ var multitenant_sdk_tokenAndClientDataInterceptor = function tokenAndClientDataI }; }; +var multitenant_sdk_authWithIdpInterceptors = function authWithIdpInterceptors(authApiEndpointInterceptors) { + return [new format_http_response_FormatHttpResponse(), new add_multitenant_client_secret_token_to_ctx_AddMultitenantClientSecretTokenToCtx(), new AddMultitenantClientSecretToParams(), new RenameIdpParamsForAuth(), new SaveToken(), new AddMultitenantAuthWithIdpResponse()].concat(multitenant_sdk_toConsumableArray(get_default()(authApiEndpointInterceptors, 'authWithIdp'))); +}; + var multitenant_sdk_createAuthApiSdkFn = function createAuthApiSdkFn(_ref2) { var ctx = _ref2.ctx, interceptors = _ref2.interceptors; @@ -14094,6 +14068,12 @@ var multitenant_sdk_authApiSdkFns = function authApiSdkFns(authApiEndpointInterc ctx: ctx, interceptors: [new add_multitenant_token_exchange_params_AddMultitenantTokenExchangeParams()].concat(multitenant_sdk_toConsumableArray(multitenant_sdk_tokenInterceptors(authApiEndpointInterceptors))) }) + }, { + path: 'loginWithIdp', + fn: multitenant_sdk_createAuthApiSdkFn({ + ctx: ctx, + interceptors: multitenant_sdk_authWithIdpInterceptors(authApiEndpointInterceptors) + }) }]; }; // Take SDK configurations, do transformation and return. diff --git a/build/sharetribe-flex-sdk-web.js b/build/sharetribe-flex-sdk-web.js index 483cac8..53d87a0 100644 --- a/build/sharetribe-flex-sdk-web.js +++ b/build/sharetribe-flex-sdk-web.js @@ -1,15 +1,15 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sharetribeSdk=e():t.sharetribeSdk=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=193)}([function(t,e,r){"use strict";(function(t){var n=r(35);const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,a=(c=Object.create(null),t=>{const e=o.call(t);return c[e]||(c[e]=e.slice(8,-1).toLowerCase())});var c;const s=t=>(t=t.toLowerCase(),e=>a(e)===t),u=t=>e=>typeof e===t,{isArray:g}=Array,l=u("undefined");const p=s("ArrayBuffer");const f=u("string"),h=u("function"),m=u("number"),d=t=>null!==t&&"object"==typeof t,y=t=>{if("object"!==a(t))return!1;const e=i(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},b=s("Date"),v=s("File"),w=s("Blob"),O=s("FileList"),_=s("URLSearchParams");function S(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,o;if("object"!=typeof t&&(t=[t]),g(t))for(n=0,o=t.length;n0;)if(n=r[o],e===n.toLowerCase())return n;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:t,T=t=>!l(t)&&t!==j;const P=(A="undefined"!=typeof Uint8Array&&i(Uint8Array),t=>A&&t instanceof A);var A;const C=s("HTMLFormElement"),x=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),L=s("RegExp"),k=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};S(r,(r,o)=>{let i;!1!==(i=e(r,o,t))&&(n[o]=i||r)}),Object.defineProperties(t,n)},D="abcdefghijklmnopqrstuvwxyz",R={DIGIT:"0123456789",ALPHA:D,ALPHA_DIGIT:D+D.toUpperCase()+"0123456789"};const I=s("AsyncFunction");e.a={isArray:g,isArrayBuffer:p,isBuffer:function(t){return null!==t&&!l(t)&&null!==t.constructor&&!l(t.constructor)&&h(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||h(t.append)&&("formdata"===(e=a(t))||"object"===e&&h(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&p(t.buffer),e},isString:f,isNumber:m,isBoolean:t=>!0===t||!1===t,isObject:d,isPlainObject:y,isUndefined:l,isDate:b,isFile:v,isBlob:w,isRegExp:L,isFunction:h,isStream:t=>d(t)&&h(t.pipe),isURLSearchParams:_,isTypedArray:P,isFileList:O,forEach:S,merge:function t(){const{caseless:e}=T(this)&&this||{},r={},n=(n,o)=>{const i=e&&E(r,o)||o;y(r[i])&&y(n)?r[i]=t(r[i],n):y(n)?r[i]=t({},n):g(n)?r[i]=n.slice():r[i]=n};for(let t=0,e=arguments.length;t(S(e,(e,o)=>{r&&h(e)?t[o]=Object(n.a)(e,r):t[o]=e},{allOwnKeys:o}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let o,a,c;const s={};if(e=e||{},null==t)return e;do{for(o=Object.getOwnPropertyNames(t),a=o.length;a-- >0;)c=o[a],n&&!n(c,t,e)||s[c]||(e[c]=t[c],s[c]=!0);t=!1!==r&&i(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:a,kindOfTest:s,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(g(t))return t;let e=t.length;if(!m(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:C,hasOwnProperty:x,hasOwnProp:x,reduceDescriptors:k,freezeMethods:t=>{k(t,(e,r)=>{if(h(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];h(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach(t=>{r[t]=!0})};return g(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:E,global:j,isContextDefined:T,ALPHABET:R,generateString:(t=16,e=R.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&h(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(d(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const o=g(t)?[]:{};return S(t,(t,e)=>{const i=r(t,n+1);!l(i)&&(o[e]=i)}),e[n]=void 0,o}}return t};return r(t,0)},isAsyncFn:I,isThenable:t=>t&&(d(t)||h(t))&&h(t.then)&&h(t.catch)}}).call(this,r(24))},function(t,e,r){"use strict";var n=r(0);function o(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}n.a.inherits(o,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n.a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const i=o.prototype,a={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{a[t]={value:t}}),Object.defineProperties(o,a),Object.defineProperty(i,"isAxiosError",{value:!0}),o.from=(t,e,r,a,c,s)=>{const u=Object.create(i);return n.a.toFlatObject(t,u,(function(t){return t!==Error.prototype}),t=>"isAxiosError"!==t),o.call(u,t.message,e,r,a,c),u.cause=t,u.name=t.name,s&&Object.assign(u,s),u},e.a=o},function(t,e,r){var n=r(30);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){var n=r(46);t.exports=function(t,e,r){return null==t?t:n(t,e,r)}},function(t,e,r){var n=r(51),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){"use strict";(function(t){var n=r(0),o=r(1),i=r(36);function a(t){return n.a.isPlainObject(t)||n.a.isArray(t)}function c(t){return n.a.endsWith(t,"[]")?t.slice(0,-2):t}function s(t,e,r){return t?t.concat(e).map((function(t,e){return t=c(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const u=n.a.toFlatObject(n.a,{},null,(function(t){return/^is[A-Z]/.test(t)}));e.a=function(e,r,g){if(!n.a.isObject(e))throw new TypeError("target must be an object");r=r||new(i.a||FormData);const l=(g=n.a.toFlatObject(g,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!n.a.isUndefined(e[t])}))).metaTokens,p=g.visitor||y,f=g.dots,h=g.indexes,m=(g.Blob||"undefined"!=typeof Blob&&Blob)&&n.a.isSpecCompliantForm(r);if(!n.a.isFunction(p))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(n.a.isDate(e))return e.toISOString();if(!m&&n.a.isBlob(e))throw new o.a("Blob is not supported. Use a Buffer instead.");return n.a.isArrayBuffer(e)||n.a.isTypedArray(e)?m&&"function"==typeof Blob?new Blob([e]):t.from(e):e}function y(t,e,o){let i=t;if(t&&!o&&"object"==typeof t)if(n.a.endsWith(e,"{}"))e=l?e:e.slice(0,-2),t=JSON.stringify(t);else if(n.a.isArray(t)&&function(t){return n.a.isArray(t)&&!t.some(a)}(t)||(n.a.isFileList(t)||n.a.endsWith(e,"[]"))&&(i=n.a.toArray(t)))return e=c(e),i.forEach((function(t,o){!n.a.isUndefined(t)&&null!==t&&r.append(!0===h?s([e],o,f):null===h?e:e+"[]",d(t))})),!1;return!!a(t)||(r.append(s(o,e,f),d(t)),!1)}const b=[],v=Object.assign(u,{defaultVisitor:y,convertValue:d,isVisitable:a});if(!n.a.isObject(e))throw new TypeError("data must be an object");return function t(e,o){if(!n.a.isUndefined(e)){if(-1!==b.indexOf(e))throw Error("Circular reference detected in "+o.join("."));b.push(e),n.a.forEach(e,(function(e,i){!0===(!(n.a.isUndefined(e)||null===e)&&p.call(r,e,n.a.isString(i)?i.trim():i,o,v))&&t(e,o?o.concat(i):[i])})),b.pop()}}(e),r}}).call(this,r(189).Buffer)},function(module,exports,__webpack_require__){(function(global){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.checkStringArgs=function(t,e,r){if(null==t)throw new TypeError("The 'this' value for String.prototype."+r+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+r+" must not be a regular expression");return t+""},$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,r){t!=Array.prototype&&t!=Object.prototype&&(t[e]=r.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:void 0!==global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.polyfill=function(t,e,r,n){if(e){for(r=$jscomp.global,t=t.split("."),n=0;nt||1342177279>>=1)&&(e+=e);return r}}),"es6-impl","es3"),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.symbolCounter_=0,$jscomp.Symbol=function(t){return $jscomp.SYMBOL_PREFIX+(t||"")+$jscomp.symbolCounter_++},$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype((function(){return e<\/script>')},goog.appendScriptSrcNode_=function(t){var e=goog.global.document,r=e.createElement("script");r.type="text/javascript",r.src=t,r.defer=!1,r.async=!1,e.head.appendChild(r)},goog.writeScriptTag_=function(t,e){if(goog.inHtmlDocument_()){var r=goog.global.document;if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&"complete"==r.readyState){if(/\bdeps.js$/.test(t))return!1;throw Error('Cannot write "'+t+'" after document load')}if(void 0===e)if(goog.IS_OLD_IE_){goog.oldIeWaiting_=!0;var n=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ";r.write('