Lewati ke konten utama

signUp

Pendaftaran pengguna (❗️Untuk penyedia dengan aktivasi pengguna, kode aktivasi dikirim melalui metode notifikasi pengguna yang sesuai)

Deskripsi

Metode ini menerima body sebagai parameter. Ini mengembalikan Promise yang menyelesaikan menjadi objek ISignUpEntity.

AuthProvider.signUp(

marker*, body*, langCode

);

Skema parameter

Skema

marker(diperlukan): string
Pengidentifikasi teks dari penyedia otorisasi
contoh: "email"

body(diperlukan): ISignUpData
Body permintaan
contoh:

{
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Name"
}
],
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
}

body.formIdentifier(diperlukan): string
Pengidentifikasi untuk formulir pendaftaran.
contoh: "reg"

body.langCode: string
Kode bahasa. Default: "en_US".

body.authData(diperlukan): Array
Array objek data otentikasi, masing-masing berisi marker dan nilai yang sesuai.

body.formData(diperlukan): IAuthFormData | IAuthFormData[]
Data formulir untuk pendaftaran.

formData.marker(diperlukan): string
Pengidentifikasi unik untuk field formulir.
contoh: "email"

formData.type(diperlukan): string
Jenis field formulir, seperti 'string', 'email', dll.
contoh: "string"

formData.value(diperlukan): string
Nilai yang dimasukkan di field formulir.
contoh: "example@oneentry.cloud"

body.notificationData(diperlukan): INotificationData
Objek yang berisi data notifikasi, termasuk email, phonePush, dan phoneSMS.

notificationData.email(diperlukan): string
Email pengguna yang digunakan untuk notifikasi.
contoh: "example@oneentry.cloud"

notificationData.phonePush(diperlukan): string[]
Nomor telepon yang digunakan untuk notifikasi push.
contoh: ["+19999999999"]

notificationData.phoneSMS: string
Nomor telepon yang digunakan untuk notifikasi SMS.
contoh: "+19999999999"

langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"

Contoh

Contoh minimal


const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value":"12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Nama"
}
],
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe sederhana formData "string", "integer", "float".

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Fyodor Ivanov"
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "date", "dateTime", "time"

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "birthday",
"type": "date",
"value": {
"fullDate": "2024-05-07T21:02:00.000Z",
"formattedValue": "08-05-2024 00:02",
"formatString": "DD-MM-YYYY HH:mm"
}
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "text"

Untuk nilai field teks, Anda dapat menggunakan salah satu dari tiga tipe nilai:

  • htmlValue - string HTML
  • plainValue - string
  • mdValue - string Markdown
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "text",
"value": {
"htmlValue": "<p>This is me</p>",
// "plainValue": "",
// "mdValue": ""
}
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "textWithHeader"

Untuk nilai field textWithHeader, Anda dapat menggunakan salah satu dari tiga tipe nilai:

  • htmlValue - string HTML
  • plainValue - string
  • mdValue - string Markdown
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "textWithHeader",
"value": {
"header": "Header",
"htmlValue": "<p>This is me</p>",
// "plainValue": "",
// "mdValue": ""
}
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "image" dan "groupOfImages"

Jika objek fileQuery disediakan dalam objek formData, file akan secara otomatis diunggah ke cloud OneEntry melalui SDK atau menggunakan handle File.uploadFile() Lihat contoh

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "image",
type: "image",
value: [file],
fileQuery: {
type: "page",
entity: "editor",
id: 3492,
},
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "file"

Jika objek fileQuery disediakan dalam objek formData, file akan secara otomatis diunggah ke cloud OneEntry melalui SDK atau menggunakan handle File.uploadFile() Lihat contoh

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "image",
type: "image",
value: [file],
fileQuery: {
type: "page",
entity: "editor",
id: 3492,
},
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "radioButton" dan "list"

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "list",
type: "list",
value: ["1"],
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh dengan atribut tipe "entity" (daftar bersarang)

const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "entity",
type: "entity",
value: [2954, 2957],
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};

const response = await AuthProvider.signUp('email', body);

Contoh respons

{
"identifier": "my-id",
"id": 1764,
"createdDate": "1991-08-18T06:18:10.986Z",
"updatedDate": "1967-12-02T16:45:02.051Z",
"version": 10,
"isActive": false,
"isDeleted": false,
"formData": {
"en_US": [
{
"marker": "login",
"type": "string",
"value": "test"
},
{
"marker": "f-name",
"type": "string",
"value": "Ivanov"
}
]
},
"state": {},
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+89991234567"
},
"locale": "en_US",
"deletedAt": "2023-02-12 10:56",
"rating": {
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "average"
}
}

Skema respons

Skema: ISignUpEntity

id: number
Pengidentifikasi unik dari entitas pendaftaran.
contoh: 12345

updatedDate: string
Tanggal ketika entitas pendaftaran terakhir diperbarui.
contoh: "2023-10-01T12:00:00Z"

version: number
Nomor versi dari entitas pendaftaran.
contoh: 1

identifier: string
String unik yang mengidentifikasi entitas pendaftaran.
contoh: "signup_12345"

isActive: boolean
Menunjukkan apakah entitas pendaftaran aktif.
contoh: true

formData: IAuthFormData[]
Array data formulir.
contoh:

[
{
"marker": "first_name",
"value": "John"
}
]

formData.marker: string
Pengidentifikasi unik untuk field formulir.
contoh: "email"

formData.type: string
Jenis field formulir, seperti 'string', 'email', dll.
contoh: "string"

formData.value: string
Nilai yang dimasukkan di field formulir.
contoh: "example@oneentry.cloud"

notificationData: INotificationData
Objek yang berisi data notifikasi, termasuk email, phonePush, dan phoneSMS.
contoh:

{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}

notificationData.email: string
Email pengguna yang digunakan untuk notifikasi.
contoh: "example@oneentry.cloud"

notificationData.phonePush: string[]
Nomor telepon yang digunakan untuk notifikasi push.
contoh: ["+19999999999"]

notificationData.phoneSMS: string
Nomor telepon yang digunakan untuk notifikasi SMS.
contoh: "+19999999999"

locale: string
Kode lokal atau bahasa yang terkait dengan entitas pendaftaran.
contoh: "en_US"

createdDate: string
Tanggal ketika entitas pendaftaran dibuat.
contoh: "2023-10-01T12:00:00Z"

importId: unknown
Pengidentifikasi impor.
contoh: null

deletedAt: string | null
Tanggal penghapusan atau null.
contoh: null

isDeleted: boolean
Apakah entitas telah dihapus.
contoh: false

state: Record<string, unknown>
Informasi status tambahan.
contoh:

{}

rating: IRating
Data penilaian.


Contoh penggunaan

Panduan langkah demi langkah dalam dokumentasi:

  • Daftar pengguna — ambil formulir pendaftaran, kumpulkan data pengguna, dan daftarkan akun melalui AuthProvider.signUp().

Coba secara langsung

Jalankan metode ini secara interaktif di JS SDK sandbox — sambungkan URL Proyek dan Token Aplikasi Anda pada kunjungan pertama, lalu buka:

  • Daftar pengguna — ambil formulir pendaftaran, kumpulkan data pengguna, dan daftarkan akun melalui AuthProvider.signUp().