@aws-amplify/ui-react 1.2.26-unstable.2 → 2.0.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.
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.css.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/legacy.js +1 -0
- package/dist/esm/legacy.js.map +7 -0
- package/dist/index.css +1 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +7533 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +7 -0
- package/dist/legacy.d.ts +1 -0
- package/dist/legacy.js +1 -0
- package/dist/legacy.js.map +7 -0
- package/dist/primitives.json +22168 -0
- package/legacy/package.json +7 -0
- package/package.json +82 -40
- package/CHANGELOG.md +0 -339
- package/README.md +0 -1
- package/build.js +0 -5
- package/dist/0.js +0 -269
- package/dist/0.js.map +0 -1
- package/dist/1.js +0 -2111
- package/dist/1.js.map +0 -1
- package/dist/10.js +0 -707
- package/dist/10.js.map +0 -1
- package/dist/11.js +0 -45
- package/dist/11.js.map +0 -1
- package/dist/12.js +0 -1152
- package/dist/12.js.map +0 -1
- package/dist/13.js +0 -114
- package/dist/13.js.map +0 -1
- package/dist/14.js +0 -1194
- package/dist/14.js.map +0 -1
- package/dist/15.js +0 -61
- package/dist/15.js.map +0 -1
- package/dist/16.js +0 -37
- package/dist/16.js.map +0 -1
- package/dist/17.js +0 -127
- package/dist/17.js.map +0 -1
- package/dist/18.js +0 -90
- package/dist/18.js.map +0 -1
- package/dist/19.js +0 -267
- package/dist/19.js.map +0 -1
- package/dist/2.js +0 -766
- package/dist/2.js.map +0 -1
- package/dist/20.js +0 -74
- package/dist/20.js.map +0 -1
- package/dist/21.js +0 -50
- package/dist/21.js.map +0 -1
- package/dist/22.js +0 -57
- package/dist/22.js.map +0 -1
- package/dist/23.js +0 -50
- package/dist/23.js.map +0 -1
- package/dist/24.js +0 -271
- package/dist/24.js.map +0 -1
- package/dist/25.js +0 -102
- package/dist/25.js.map +0 -1
- package/dist/26.js +0 -64
- package/dist/26.js.map +0 -1
- package/dist/27.js +0 -379
- package/dist/27.js.map +0 -1
- package/dist/28.js +0 -47
- package/dist/28.js.map +0 -1
- package/dist/29.js +0 -46
- package/dist/29.js.map +0 -1
- package/dist/3.js +0 -2787
- package/dist/3.js.map +0 -1
- package/dist/30.js +0 -503
- package/dist/30.js.map +0 -1
- package/dist/31.js +0 -2
- package/dist/31.js.map +0 -1
- package/dist/32.js +0 -2
- package/dist/32.js.map +0 -1
- package/dist/33.js +0 -13
- package/dist/33.js.map +0 -1
- package/dist/4.js +0 -4126
- package/dist/4.js.map +0 -1
- package/dist/5.js +0 -817
- package/dist/5.js.map +0 -1
- package/dist/6.js +0 -619
- package/dist/6.js.map +0 -1
- package/dist/7.js +0 -662
- package/dist/7.js.map +0 -1
- package/dist/8.js +0 -614
- package/dist/8.js.map +0 -1
- package/dist/9.js +0 -665
- package/dist/9.js.map +0 -1
- package/dist/@aws-amplify/ui-react.js +0 -31875
- package/dist/@aws-amplify/ui-react.js.map +0 -1
- package/dist/aws-amplify-react.min.js +0 -28
- package/dist/aws-amplify-react.min.js.map +0 -1
- package/dist/polyfills-core-js.js +0 -5211
- package/dist/polyfills-core-js.js.map +0 -1
- package/dist/polyfills-css-shim.js +0 -467
- package/dist/polyfills-css-shim.js.map +0 -1
- package/dist/polyfills-dom.js +0 -2098
- package/dist/polyfills-dom.js.map +0 -1
- package/jest.config.js +0 -12
- package/lib/components.d.ts +0 -56
- package/lib/components.js +0 -64
- package/lib/components.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -9
- package/lib/index.js.map +0 -1
- package/lib/react-component-lib/createComponent.d.ts +0 -2
- package/lib/react-component-lib/createComponent.js +0 -91
- package/lib/react-component-lib/createComponent.js.map +0 -1
- package/lib/react-component-lib/createControllerComponent.d.ts +0 -43
- package/lib/react-component-lib/createControllerComponent.js +0 -152
- package/lib/react-component-lib/createControllerComponent.js.map +0 -1
- package/lib/react-component-lib/createOverlayComponent.d.ts +0 -45
- package/lib/react-component-lib/createOverlayComponent.js +0 -148
- package/lib/react-component-lib/createOverlayComponent.js.map +0 -1
- package/lib/react-component-lib/index.d.ts +0 -3
- package/lib/react-component-lib/index.js +0 -9
- package/lib/react-component-lib/index.js.map +0 -1
- package/lib/react-component-lib/utils/attachEventProps.d.ts +0 -8
- package/lib/react-component-lib/utils/attachEventProps.js +0 -85
- package/lib/react-component-lib/utils/attachEventProps.js.map +0 -1
- package/lib/react-component-lib/utils/index.d.ts +0 -8
- package/lib/react-component-lib/utils/index.js +0 -36
- package/lib/react-component-lib/utils/index.js.map +0 -1
- package/lib/withAuthenticator.d.ts +0 -3
- package/lib/withAuthenticator.js +0 -127
- package/lib/withAuthenticator.js.map +0 -1
- package/lib-esm/components.d.ts +0 -56
- package/lib-esm/components.js +0 -62
- package/lib-esm/components.js.map +0 -1
- package/lib-esm/index.d.ts +0 -2
- package/lib-esm/index.js +0 -3
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/react-component-lib/createComponent.d.ts +0 -2
- package/lib-esm/react-component-lib/createComponent.js +0 -86
- package/lib-esm/react-component-lib/createComponent.js.map +0 -1
- package/lib-esm/react-component-lib/createControllerComponent.d.ts +0 -43
- package/lib-esm/react-component-lib/createControllerComponent.js +0 -146
- package/lib-esm/react-component-lib/createControllerComponent.js.map +0 -1
- package/lib-esm/react-component-lib/createOverlayComponent.d.ts +0 -45
- package/lib-esm/react-component-lib/createOverlayComponent.js +0 -142
- package/lib-esm/react-component-lib/createOverlayComponent.js.map +0 -1
- package/lib-esm/react-component-lib/index.d.ts +0 -3
- package/lib-esm/react-component-lib/index.js +0 -4
- package/lib-esm/react-component-lib/index.js.map +0 -1
- package/lib-esm/react-component-lib/utils/attachEventProps.d.ts +0 -8
- package/lib-esm/react-component-lib/utils/attachEventProps.js +0 -79
- package/lib-esm/react-component-lib/utils/attachEventProps.js.map +0 -1
- package/lib-esm/react-component-lib/utils/index.d.ts +0 -8
- package/lib-esm/react-component-lib/utils/index.js +0 -28
- package/lib-esm/react-component-lib/utils/index.js.map +0 -1
- package/lib-esm/withAuthenticator.d.ts +0 -3
- package/lib-esm/withAuthenticator.js +0 -121
- package/lib-esm/withAuthenticator.js.map +0 -1
- package/src/components.ts +0 -65
- package/src/index.ts +0 -3
- package/src/react-component-lib/createComponent.tsx +0 -69
- package/src/react-component-lib/createControllerComponent.tsx +0 -71
- package/src/react-component-lib/createOverlayComponent.tsx +0 -79
- package/src/react-component-lib/index.ts +0 -3
- package/src/react-component-lib/utils/attachEventProps.ts +0 -87
- package/src/react-component-lib/utils/index.tsx +0 -31
- package/src/withAuthenticator.tsx +0 -62
- package/webpack.config.dev.js +0 -6
- package/webpack.config.js +0 -56
package/dist/10.js
DELETED
|
@@ -1,707 +0,0 @@
|
|
|
1
|
-
(this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[10],{
|
|
2
|
-
|
|
3
|
-
/***/ "../amplify-ui-components/dist/esm-es5/amplify-amazon-button_5.entry.js":
|
|
4
|
-
/*!******************************************************************************!*\
|
|
5
|
-
!*** ../amplify-ui-components/dist/esm-es5/amplify-amazon-button_5.entry.js ***!
|
|
6
|
-
\******************************************************************************/
|
|
7
|
-
/*! exports provided: amplify_amazon_button, amplify_auth0_button, amplify_facebook_button, amplify_google_button, amplify_oauth_button */
|
|
8
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9
|
-
|
|
10
|
-
"use strict";
|
|
11
|
-
__webpack_require__.r(__webpack_exports__);
|
|
12
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_amazon_button", function() { return AmplifyAmazonButton; });
|
|
13
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_auth0_button", function() { return AmplifyAuth0Button; });
|
|
14
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_facebook_button", function() { return AmplifyFacebookButton; });
|
|
15
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_google_button", function() { return AmplifyGoogleButton; });
|
|
16
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_oauth_button", function() { return AmplifyOAuthButton; });
|
|
17
|
-
/* harmony import */ var _index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-83f2275b.js */ "../amplify-ui-components/dist/esm-es5/index-83f2275b.js");
|
|
18
|
-
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
19
|
-
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
20
|
-
/* harmony import */ var _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./auth-types-78df304e.js */ "../amplify-ui-components/dist/esm-es5/auth-types-78df304e.js");
|
|
21
|
-
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
22
|
-
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__);
|
|
23
|
-
/* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
|
|
24
|
-
/* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
|
|
25
|
-
/* harmony import */ var _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers-14fcb50c.js */ "../amplify-ui-components/dist/esm-es5/helpers-14fcb50c.js");
|
|
26
|
-
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
27
|
-
function adopt(value) {
|
|
28
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
29
|
-
resolve(value);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function rejected(value) {
|
|
43
|
-
try {
|
|
44
|
-
step(generator["throw"](value));
|
|
45
|
-
} catch (e) {
|
|
46
|
-
reject(e);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function step(result) {
|
|
51
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
59
|
-
var _ = {
|
|
60
|
-
label: 0,
|
|
61
|
-
sent: function sent() {
|
|
62
|
-
if (t[0] & 1) throw t[1];
|
|
63
|
-
return t[1];
|
|
64
|
-
},
|
|
65
|
-
trys: [],
|
|
66
|
-
ops: []
|
|
67
|
-
},
|
|
68
|
-
f,
|
|
69
|
-
y,
|
|
70
|
-
t,
|
|
71
|
-
g;
|
|
72
|
-
return g = {
|
|
73
|
-
next: verb(0),
|
|
74
|
-
"throw": verb(1),
|
|
75
|
-
"return": verb(2)
|
|
76
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
77
|
-
return this;
|
|
78
|
-
}), g;
|
|
79
|
-
|
|
80
|
-
function verb(n) {
|
|
81
|
-
return function (v) {
|
|
82
|
-
return step([n, v]);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function step(op) {
|
|
87
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
88
|
-
|
|
89
|
-
while (_) {
|
|
90
|
-
try {
|
|
91
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
92
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
93
|
-
|
|
94
|
-
switch (op[0]) {
|
|
95
|
-
case 0:
|
|
96
|
-
case 1:
|
|
97
|
-
t = op;
|
|
98
|
-
break;
|
|
99
|
-
|
|
100
|
-
case 4:
|
|
101
|
-
_.label++;
|
|
102
|
-
return {
|
|
103
|
-
value: op[1],
|
|
104
|
-
done: false
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
case 5:
|
|
108
|
-
_.label++;
|
|
109
|
-
y = op[1];
|
|
110
|
-
op = [0];
|
|
111
|
-
continue;
|
|
112
|
-
|
|
113
|
-
case 7:
|
|
114
|
-
op = _.ops.pop();
|
|
115
|
-
|
|
116
|
-
_.trys.pop();
|
|
117
|
-
|
|
118
|
-
continue;
|
|
119
|
-
|
|
120
|
-
default:
|
|
121
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
122
|
-
_ = 0;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
127
|
-
_.label = op[1];
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
132
|
-
_.label = t[1];
|
|
133
|
-
t = op;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (t && _.label < t[2]) {
|
|
138
|
-
_.label = t[2];
|
|
139
|
-
|
|
140
|
-
_.ops.push(op);
|
|
141
|
-
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (t[2]) _.ops.pop();
|
|
146
|
-
|
|
147
|
-
_.trys.pop();
|
|
148
|
-
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
op = body.call(thisArg, _);
|
|
153
|
-
} catch (e) {
|
|
154
|
-
op = [6, e];
|
|
155
|
-
y = 0;
|
|
156
|
-
} finally {
|
|
157
|
-
f = t = 0;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (op[0] & 5) throw op[1];
|
|
162
|
-
return {
|
|
163
|
-
value: op[0] ? op[1] : void 0,
|
|
164
|
-
done: true
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-amazon-button');
|
|
177
|
-
|
|
178
|
-
var AmplifyAmazonButton =
|
|
179
|
-
/** @class */
|
|
180
|
-
function () {
|
|
181
|
-
function class_1(hostRef) {
|
|
182
|
-
var _this = this;
|
|
183
|
-
|
|
184
|
-
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
185
|
-
/** Auth state change handler for this component
|
|
186
|
-
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
190
|
-
|
|
191
|
-
this.federatedSignIn = function (response) {
|
|
192
|
-
var access_token = response.access_token,
|
|
193
|
-
expires_in = response.expires_in;
|
|
194
|
-
|
|
195
|
-
if (!access_token) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
|
|
200
|
-
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
var date = new Date();
|
|
204
|
-
var expires_at = expires_in * 1000 + date.getTime();
|
|
205
|
-
window['amazon'].Login.retrieveProfile(function (userInfo) {
|
|
206
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
207
|
-
var user, authenticatedUser;
|
|
208
|
-
return __generator(this, function (_a) {
|
|
209
|
-
switch (_a.label) {
|
|
210
|
-
case 0:
|
|
211
|
-
if (!userInfo.success) {
|
|
212
|
-
return [2
|
|
213
|
-
/*return*/
|
|
214
|
-
, logger.debug('Get user Info failed')];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
user = {
|
|
218
|
-
name: userInfo.profile.Name,
|
|
219
|
-
email: userInfo.profile.PrimaryEmail
|
|
220
|
-
};
|
|
221
|
-
return [4
|
|
222
|
-
/*yield*/
|
|
223
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('amazon', {
|
|
224
|
-
token: access_token,
|
|
225
|
-
expires_at: expires_at
|
|
226
|
-
}, user)];
|
|
227
|
-
|
|
228
|
-
case 1:
|
|
229
|
-
_a.sent();
|
|
230
|
-
|
|
231
|
-
return [4
|
|
232
|
-
/*yield*/
|
|
233
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
234
|
-
|
|
235
|
-
case 2:
|
|
236
|
-
authenticatedUser = _a.sent();
|
|
237
|
-
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
|
|
238
|
-
return [2
|
|
239
|
-
/*return*/
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* @see https://developer.amazon.com/docs/login-with-amazon/install-sdk-javascript.html
|
|
249
|
-
*/
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
class_1.prototype.signInWithAmazon = function (event) {
|
|
253
|
-
var _this = this;
|
|
254
|
-
|
|
255
|
-
event.preventDefault();
|
|
256
|
-
window['amazon'].Login.setClientId(this.clientId);
|
|
257
|
-
window['amazon'].Login.authorize({
|
|
258
|
-
scope: 'profile'
|
|
259
|
-
}, function (response) {
|
|
260
|
-
if (response.error) {
|
|
261
|
-
return logger.debug('Failed to login with amazon: ' + response.error);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
window.localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify({
|
|
266
|
-
provider: 'amazon'
|
|
267
|
-
}));
|
|
268
|
-
} catch (e) {
|
|
269
|
-
logger.debug('Failed to cache auth source into localStorage', e);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
_this.federatedSignIn(response);
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
class_1.prototype.render = function () {
|
|
277
|
-
var _this = this;
|
|
278
|
-
|
|
279
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
|
|
280
|
-
onClick: function onClick(event) {
|
|
281
|
-
return _this.signInWithAmazon(event);
|
|
282
|
-
},
|
|
283
|
-
provider: "amazon"
|
|
284
|
-
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("script", {
|
|
285
|
-
src: "https://assets.loginwithamazon.com/sdk/na/login1.js"
|
|
286
|
-
}), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AMAZON));
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
return class_1;
|
|
290
|
-
}();
|
|
291
|
-
|
|
292
|
-
var logger$1 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-auth0-button');
|
|
293
|
-
|
|
294
|
-
var AmplifyAuth0Button =
|
|
295
|
-
/** @class */
|
|
296
|
-
function () {
|
|
297
|
-
function class_2(hostRef) {
|
|
298
|
-
var _this = this;
|
|
299
|
-
|
|
300
|
-
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
301
|
-
/** Auth state change handler for this component */
|
|
302
|
-
|
|
303
|
-
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
304
|
-
|
|
305
|
-
this.handleLoad = function () {
|
|
306
|
-
// @ts-ignore Property 'auth0' does not exist on type '{}'.
|
|
307
|
-
var _a = _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].configure().oauth,
|
|
308
|
-
oauth = _a === void 0 ? {} : _a; // @ts-ignore Property 'auth0' does not exist on type '{}'.
|
|
309
|
-
|
|
310
|
-
var _b = _this.config,
|
|
311
|
-
config = _b === void 0 ? oauth.auth0 : _b;
|
|
312
|
-
|
|
313
|
-
if (!config) {
|
|
314
|
-
logger$1.debug('Auth0 is not configured');
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
logger$1.debug('auth0 configuration', config);
|
|
319
|
-
|
|
320
|
-
if (!_this._auth0) {
|
|
321
|
-
_this._auth0 = new window['auth0'].WebAuth(config);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
_this._auth0.parseHash(function (err, authResult) {
|
|
325
|
-
if (err) {
|
|
326
|
-
logger$1.debug('Failed to parse the url for Auth0', err);
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (!authResult) {
|
|
331
|
-
logger$1.debug('Auth0 found no authResult in hash');
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var payload = {
|
|
336
|
-
provider: 'auth0',
|
|
337
|
-
opts: {
|
|
338
|
-
returnTo: config.returnTo,
|
|
339
|
-
clientID: config.clientID,
|
|
340
|
-
federated: config.federated
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
try {
|
|
345
|
-
localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify(payload));
|
|
346
|
-
} catch (e) {
|
|
347
|
-
logger$1.debug('Failed to cache auth source into localStorage', e);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
_this._auth0.client.userInfo(authResult.accessToken, function (err, user) {
|
|
351
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
352
|
-
var username, email, authenticatedUser;
|
|
353
|
-
return __generator(this, function (_a) {
|
|
354
|
-
switch (_a.label) {
|
|
355
|
-
case 0:
|
|
356
|
-
username = undefined;
|
|
357
|
-
email = undefined;
|
|
358
|
-
|
|
359
|
-
if (err) {
|
|
360
|
-
logger$1.debug('Failed to get the user info', err);
|
|
361
|
-
} else {
|
|
362
|
-
username = user.name;
|
|
363
|
-
email = user.email;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return [4
|
|
367
|
-
/*yield*/
|
|
368
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn(config.domain, {
|
|
369
|
-
token: authResult.idToken,
|
|
370
|
-
expires_at: authResult.expiresIn * 1000 + new Date().getTime()
|
|
371
|
-
}, {
|
|
372
|
-
name: username,
|
|
373
|
-
email: email
|
|
374
|
-
})];
|
|
375
|
-
|
|
376
|
-
case 1:
|
|
377
|
-
_a.sent();
|
|
378
|
-
|
|
379
|
-
return [4
|
|
380
|
-
/*yield*/
|
|
381
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
382
|
-
|
|
383
|
-
case 2:
|
|
384
|
-
authenticatedUser = _a.sent();
|
|
385
|
-
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
|
|
386
|
-
return [2
|
|
387
|
-
/*return*/
|
|
388
|
-
];
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
class_2.prototype.signInWithAuth0 = function (event) {
|
|
398
|
-
event.preventDefault();
|
|
399
|
-
|
|
400
|
-
if (!this._auth0) {
|
|
401
|
-
throw new Error('the auth0 client is not configured');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
this._auth0.authorize();
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
class_2.prototype.render = function () {
|
|
408
|
-
var _this = this;
|
|
409
|
-
|
|
410
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
|
|
411
|
-
onClick: function onClick(event) {
|
|
412
|
-
return _this.signInWithAuth0(event);
|
|
413
|
-
},
|
|
414
|
-
provider: "auth0"
|
|
415
|
-
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("script", {
|
|
416
|
-
onLoad: this.handleLoad,
|
|
417
|
-
src: "https://cdn.auth0.com/js/auth0/9.11/auth0.min.js"
|
|
418
|
-
}), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AUTH0));
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
return class_2;
|
|
422
|
-
}();
|
|
423
|
-
|
|
424
|
-
var logger$2 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-facebook-button');
|
|
425
|
-
|
|
426
|
-
var AmplifyFacebookButton =
|
|
427
|
-
/** @class */
|
|
428
|
-
function () {
|
|
429
|
-
function class_3(hostRef) {
|
|
430
|
-
var _this = this;
|
|
431
|
-
|
|
432
|
-
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
433
|
-
/** Auth state change handler for this component
|
|
434
|
-
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
435
|
-
*/
|
|
436
|
-
|
|
437
|
-
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
438
|
-
|
|
439
|
-
this.federatedSignIn = function (authResponse) {
|
|
440
|
-
var accessToken = authResponse.accessToken,
|
|
441
|
-
expiresIn = authResponse.expiresIn;
|
|
442
|
-
|
|
443
|
-
if (!accessToken) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
|
|
448
|
-
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
var date = new Date();
|
|
452
|
-
var expires_at = expiresIn * 1000 + date.getTime();
|
|
453
|
-
var fields = 'name,email';
|
|
454
|
-
window['FB'].api('/me', {
|
|
455
|
-
fields: fields
|
|
456
|
-
}, function (response) {
|
|
457
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
458
|
-
var user, authenticatedUser;
|
|
459
|
-
return __generator(this, function (_a) {
|
|
460
|
-
switch (_a.label) {
|
|
461
|
-
case 0:
|
|
462
|
-
user = {
|
|
463
|
-
name: response.name,
|
|
464
|
-
email: response.email
|
|
465
|
-
};
|
|
466
|
-
return [4
|
|
467
|
-
/*yield*/
|
|
468
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('facebook', {
|
|
469
|
-
token: accessToken,
|
|
470
|
-
expires_at: expires_at
|
|
471
|
-
}, user)];
|
|
472
|
-
|
|
473
|
-
case 1:
|
|
474
|
-
_a.sent();
|
|
475
|
-
|
|
476
|
-
return [4
|
|
477
|
-
/*yield*/
|
|
478
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
479
|
-
|
|
480
|
-
case 2:
|
|
481
|
-
authenticatedUser = _a.sent();
|
|
482
|
-
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
|
|
483
|
-
return [2
|
|
484
|
-
/*return*/
|
|
485
|
-
];
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
this.getLoginStatus = function () {
|
|
493
|
-
window['FB'].getLoginStatus(function (response) {
|
|
494
|
-
try {
|
|
495
|
-
window.localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify({
|
|
496
|
-
provider: 'facebook'
|
|
497
|
-
}));
|
|
498
|
-
} catch (e) {
|
|
499
|
-
logger$2.debug('Failed to cache auth source into localStorage', e);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if (response.status === 'connected') {
|
|
503
|
-
return _this.federatedSignIn(response.authResponse);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
_this.login();
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
this.login = function () {
|
|
511
|
-
var scope = 'public_profile,email';
|
|
512
|
-
window['FB'].login(function (response) {
|
|
513
|
-
if (response && response.authResponse) {
|
|
514
|
-
_this.federatedSignIn(response.authResponse);
|
|
515
|
-
}
|
|
516
|
-
}, {
|
|
517
|
-
scope: scope
|
|
518
|
-
});
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* @see https://developers.facebook.com/docs/javascript/reference/FB.init/v5.0
|
|
523
|
-
*/
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
class_3.prototype.signInWithFacebook = function (event) {
|
|
527
|
-
event.preventDefault();
|
|
528
|
-
window['FB'].init({
|
|
529
|
-
appId: this.appId,
|
|
530
|
-
cookie: true,
|
|
531
|
-
xfbml: false,
|
|
532
|
-
version: 'v5.0'
|
|
533
|
-
});
|
|
534
|
-
this.getLoginStatus();
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
class_3.prototype.render = function () {
|
|
538
|
-
var _this = this;
|
|
539
|
-
|
|
540
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
|
|
541
|
-
onClick: function onClick(event) {
|
|
542
|
-
return _this.signInWithFacebook(event);
|
|
543
|
-
},
|
|
544
|
-
provider: "facebook"
|
|
545
|
-
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("script", {
|
|
546
|
-
async: true,
|
|
547
|
-
defer: true,
|
|
548
|
-
src: "https://connect.facebook.net/en_US/sdk.js"
|
|
549
|
-
}), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_FACEBOOK));
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
return class_3;
|
|
553
|
-
}();
|
|
554
|
-
|
|
555
|
-
var logger$3 = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('amplify-google-button');
|
|
556
|
-
|
|
557
|
-
var AmplifyGoogleButton =
|
|
558
|
-
/** @class */
|
|
559
|
-
function () {
|
|
560
|
-
function class_4(hostRef) {
|
|
561
|
-
var _this = this;
|
|
562
|
-
|
|
563
|
-
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
564
|
-
/** Auth state change handler for this component
|
|
565
|
-
* e.g. SignIn -> 'Create Account' link -> SignUp
|
|
566
|
-
*/
|
|
567
|
-
|
|
568
|
-
this.handleAuthStateChange = _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"];
|
|
569
|
-
|
|
570
|
-
this.handleError = function (error) {
|
|
571
|
-
console.error(error);
|
|
572
|
-
};
|
|
573
|
-
/**
|
|
574
|
-
* @see https://developers.google.com/identity/sign-in/web/build-button#building_a_button_with_a_custom_graphic
|
|
575
|
-
*/
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
this.handleLoad = function () {
|
|
579
|
-
window['gapi'].load('auth2');
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
this.handleUser = function (user) {
|
|
583
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
584
|
-
var _a, id_token, expires_at, profile, authenticatedUser;
|
|
585
|
-
|
|
586
|
-
return __generator(this, function (_b) {
|
|
587
|
-
switch (_b.label) {
|
|
588
|
-
case 0:
|
|
589
|
-
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn !== 'function' || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
|
|
590
|
-
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
try {
|
|
594
|
-
window.localStorage.setItem(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["h"], JSON.stringify({
|
|
595
|
-
provider: 'google'
|
|
596
|
-
}));
|
|
597
|
-
} catch (e) {
|
|
598
|
-
logger$3.debug('Failed to cache auth source into localStorage', e);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
_a = user.getAuthResponse(), id_token = _a.id_token, expires_at = _a.expires_at;
|
|
602
|
-
profile = user.getBasicProfile();
|
|
603
|
-
return [4
|
|
604
|
-
/*yield*/
|
|
605
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn('google', {
|
|
606
|
-
token: id_token,
|
|
607
|
-
expires_at: expires_at
|
|
608
|
-
}, {
|
|
609
|
-
email: profile.getEmail(),
|
|
610
|
-
name: profile.getName(),
|
|
611
|
-
picture: profile.getImageUrl()
|
|
612
|
-
})];
|
|
613
|
-
|
|
614
|
-
case 1:
|
|
615
|
-
_b.sent();
|
|
616
|
-
|
|
617
|
-
return [4
|
|
618
|
-
/*yield*/
|
|
619
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser()];
|
|
620
|
-
|
|
621
|
-
case 2:
|
|
622
|
-
authenticatedUser = _b.sent();
|
|
623
|
-
|
|
624
|
-
try {
|
|
625
|
-
this.handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, authenticatedUser);
|
|
626
|
-
} catch (error) {
|
|
627
|
-
this.handleError(error);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
return [2
|
|
631
|
-
/*return*/
|
|
632
|
-
];
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
});
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
class_4.prototype.getAuthInstance = function () {
|
|
640
|
-
if (window['gapi'] && window['gapi'].auth2) {
|
|
641
|
-
return window['gapi'].auth2.getAuthInstance() || window['gapi'].auth2.init({
|
|
642
|
-
client_id: this.clientId,
|
|
643
|
-
cookiepolicy: 'single_host_origin',
|
|
644
|
-
scope: 'profile email openid'
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
return null;
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
class_4.prototype.signInWithGoogle = function (event) {
|
|
652
|
-
event.preventDefault();
|
|
653
|
-
this.getAuthInstance().signIn().then(this.handleUser)["catch"](this.handleError);
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
class_4.prototype.render = function () {
|
|
657
|
-
var _this = this;
|
|
658
|
-
|
|
659
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
|
|
660
|
-
onClick: function onClick(event) {
|
|
661
|
-
return _this.signInWithGoogle(event);
|
|
662
|
-
},
|
|
663
|
-
provider: "google"
|
|
664
|
-
}, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("script", {
|
|
665
|
-
onLoad: this.handleLoad,
|
|
666
|
-
src: "https://apis.google.com/js/api:client.js"
|
|
667
|
-
}), _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_GOOGLE));
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
return class_4;
|
|
671
|
-
}();
|
|
672
|
-
|
|
673
|
-
var AmplifyOAuthButton =
|
|
674
|
-
/** @class */
|
|
675
|
-
function () {
|
|
676
|
-
function AmplifyOAuthButton(hostRef) {
|
|
677
|
-
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
678
|
-
/** Federated credentials & configuration. */
|
|
679
|
-
|
|
680
|
-
this.config = {};
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
AmplifyOAuthButton.prototype.signInWithOAuth = function (event) {
|
|
684
|
-
event.preventDefault();
|
|
685
|
-
_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].federatedSignIn();
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
AmplifyOAuthButton.prototype.render = function () {
|
|
689
|
-
var _this = this;
|
|
690
|
-
|
|
691
|
-
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in-button", {
|
|
692
|
-
onClick: function onClick(event) {
|
|
693
|
-
return _this.signInWithOAuth(event);
|
|
694
|
-
},
|
|
695
|
-
provider: "oauth"
|
|
696
|
-
}, this.config.label || _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].SIGN_IN_WITH_AWS));
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
return AmplifyOAuthButton;
|
|
700
|
-
}();
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
/***/ })
|
|
705
|
-
|
|
706
|
-
}]);
|
|
707
|
-
//# sourceMappingURL=10.js.map
|