/
apple.tsx
128 lines (119 loc) · 5.9 KB
/
apple.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/*
* Imports.
*/
import NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath";
import SuperTokens from "../../../superTokens";
import { isTest } from "../../../utils";
import type { BuiltInProviderConfig } from "./types";
import Provider from ".";
/*
* Class.
*/
export default class Apple extends Provider {
/*
* Static Attributes.
*/
private static instance?: Apple;
/*
* Constructor.
*/
constructor(config?: BuiltInProviderConfig) {
super({
id: "apple",
name: "Apple",
...config,
});
}
getLogo = (): JSX.Element => {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="15.614" height="18" viewBox="0 0 15.614 18.737">
<g id="iconfinder_logo_brand_brands_logos_apple_ios_2993701" transform="translate(-2)">
<path
id="Path_91415"
d="M14.494 11.075a4.29 4.29 0 0 1 2.372-3.836A4.888 4.888 0 0 0 13.713 6a4.783 4.783 0 0 0-1.83.406 4.357 4.357 0 0 1-1.684.375 4.357 4.357 0 0 1-1.684-.375A4.783 4.783 0 0 0 6.685 6C6.206 6 2 6.153 2 11.465c0 4.344 2.964 8.587 4.685 8.587a5.18 5.18 0 0 0 2.194-.464 3.2 3.2 0 0 1 1.32-.316 3.2 3.2 0 0 1 1.32.317 5.187 5.187 0 0 0 2.194.463c1.206 0 2.922-2.085 3.9-4.826a4.209 4.209 0 0 1-3.119-4.151z"
style={{ fill: "#000" }}
transform="translate(0 -1.316)"
/>
<path
id="XMLID_1339_"
d="M12 4.684A4.734 4.734 0 0 0 15.906 0 4.734 4.734 0 0 0 12 4.684z"
style={{ fill: "#000" }}
transform="translate(-2.193)"
/>
<path
id="Path_91416"
d="M6.685 6.2a4.783 4.783 0 0 1 1.83.406 4.357 4.357 0 0 0 1.684.375 4.357 4.357 0 0 0 1.684-.381 4.783 4.783 0 0 1 1.83-.406 4.953 4.953 0 0 1 3.014 1.126c.047-.026.091-.058.14-.082A4.888 4.888 0 0 0 13.713 6a4.783 4.783 0 0 0-1.83.406 4.357 4.357 0 0 1-1.684.375 4.357 4.357 0 0 1-1.684-.375A4.783 4.783 0 0 0 6.685 6C6.206 6 2 6.153 2 11.465v.107C2.053 6.352 6.208 6.2 6.685 6.2z"
style={{ fill: "#000", opacity: 0.1 }}
transform="translate(0 -1.316)"
/>
<path
id="Path_91417"
d="M13.713 21.368a5.187 5.187 0 0 1-2.194-.463 3.2 3.2 0 0 0-1.32-.317 3.2 3.2 0 0 0-1.32.316 5.18 5.18 0 0 1-2.194.464c-1.707 0-4.633-4.174-4.681-8.48v.088c0 4.344 2.964 8.587 4.685 8.587a5.18 5.18 0 0 0 2.19-.463 3.2 3.2 0 0 1 1.32-.316 3.2 3.2 0 0 1 1.32.317 5.187 5.187 0 0 0 2.194.463c1.206 0 2.922-2.085 3.9-4.826-.023-.006-.043-.017-.066-.023-.991 2.654-2.655 4.653-3.834 4.653z"
style={{ fill: "#000", opacity: 0.2 }}
transform="translate(0 -2.826)"
/>
<path
id="Path_91418"
d="M15.888.4A4.621 4.621 0 0 1 12 4.544v.2A4.745 4.745 0 0 0 15.9.261c0 .039 0 .098-.012.139z"
style={{ fill: "#000", opacity: 0.2 }}
transform="translate(-2.193 -.057)"
/>
<path
id="Path_91419"
d="M12.005 4.477c.009-.051.02-.192.032-.278q.012-.161.035-.317A4.491 4.491 0 0 1 15.9.2V0a4.738 4.738 0 0 0-3.895 4.477z"
style={{ fill: "#000", opacity: 0.1 }}
transform="translate(-2.194)"
/>
<path
id="Path_91420"
d="M14.494 9.759a4.29 4.29 0 0 1 2.372-3.836 4.888 4.888 0 0 0-3.153-1.239 4.783 4.783 0 0 0-1.83.406 4.357 4.357 0 0 1-1.684.375 4.357 4.357 0 0 1-1.684-.375 4.783 4.783 0 0 0-1.83-.406C6.206 4.684 2 4.838 2 10.15c0 4.344 2.964 8.587 4.685 8.587a5.18 5.18 0 0 0 2.194-.464 3.2 3.2 0 0 1 1.32-.316 3.2 3.2 0 0 1 1.32.317 5.187 5.187 0 0 0 2.194.463c1.206 0 2.922-2.085 3.9-4.826a4.209 4.209 0 0 1-3.119-4.152zM13.713 0a4.734 4.734 0 0 0-3.9 4.684A4.734 4.734 0 0 0 13.713 0z"
style={{ fill: "#000" }}
/>
</g>
</svg>
);
};
getRedirectURIOnProviderDashboard(): string | undefined {
const domain = SuperTokens.getInstanceOrThrow().appInfo.apiDomain.getAsStringDangerous();
const callbackPath = new NormalisedURLPath(`/callback/${this.id}`);
const path = SuperTokens.getInstanceOrThrow()
.appInfo.apiBasePath.appendPath(callbackPath)
.getAsStringDangerous();
return `${domain}${path}`;
}
/*
* Static Methods
*/
static init(config?: BuiltInProviderConfig): Provider {
if (Apple.instance !== undefined) {
console.warn("Apple Provider was already initialized");
return Apple.instance;
}
Apple.instance = new Apple(config);
return Apple.instance;
}
/*
* Tests methods.
*/
static reset(): void {
if (!isTest()) {
return;
}
Apple.instance = undefined;
return;
}
}