@open-tender/utils 0.4.44 → 0.4.45

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.
@@ -1,9 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Customer, CustomerCreate, FormFieldType, Gender, RequestError, RequestStatus } from '@open-tender/types';
3
- export declare const genderOptions: {
4
- name: string;
5
- value: Gender;
6
- }[];
2
+ import { Customer, CustomerCreate, FormFieldType, RequestError, RequestStatus } from '@open-tender/types';
7
3
  export declare const useProfileForm: (profile: Customer | null, loading: RequestStatus, error: RequestError, update: (data: CustomerCreate) => void, callback?: ((data: CustomerCreate) => void) | undefined, optionalFields?: string[]) => {
8
4
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
9
5
  data: Customer | null;
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useProfileForm = exports.genderOptions = void 0;
3
+ exports.useProfileForm = void 0;
4
4
  const react_1 = require("react");
5
5
  const utils_1 = require("../utils");
6
- exports.genderOptions = [
7
- { name: 'not specified', value: 'DECLINED' },
8
- { name: 'Male', value: 'MALE' },
9
- { name: 'Female', value: 'FEMALE' }
10
- ];
11
6
  const allFields = [
12
7
  { label: 'First Name', name: 'first_name', type: 'text', required: true },
13
8
  { label: 'Last Name', name: 'last_name', type: 'text', required: true },
@@ -20,21 +15,13 @@ const allFields = [
20
15
  },
21
16
  { label: 'Phone', name: 'phone', type: 'tel', required: true },
22
17
  { label: 'Company', name: 'company', type: 'text' },
23
- { label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
24
- {
25
- label: 'Gender',
26
- name: 'gender',
27
- type: 'select',
28
- showLabel: true,
29
- options: exports.genderOptions
30
- }
18
+ { label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' }
31
19
  ];
32
20
  const makePayload = (fields, data) => {
33
21
  if (!data)
34
22
  return null;
35
23
  const rest = fields.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i.name]: data[i.name] })), {});
36
24
  rest.birth_date = data.birth_date ? (0, utils_1.slashesToDashes)(data.birth_date) : null;
37
- rest.gender = data.gender || null;
38
25
  return rest;
39
26
  };
40
27
  const useProfileForm = (profile, loading, error, update, callback, optionalFields) => {
@@ -46,8 +33,6 @@ const useProfileForm = (profile, loading, error, update, callback, optionalField
46
33
  const removed = [];
47
34
  if (optionalFields && !optionalFields.includes('birth_date'))
48
35
  removed.push('birth_date');
49
- if (optionalFields && !optionalFields.includes('gender'))
50
- removed.push('gender');
51
36
  return removed;
52
37
  }, [optionalFields]);
53
38
  // const fields = allFields.filter((i) => !toRemove.includes(i.name))
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useSignUpForm = void 0;
4
4
  const react_1 = require("react");
5
5
  const utils_1 = require("../utils");
6
- const useProfileForm_1 = require("./useProfileForm");
7
6
  const initState = {
8
7
  first_name: '',
9
8
  last_name: '',
@@ -45,8 +44,6 @@ const useSignUpForm = (loading, error, signUp, callback, checkConfig, hidePasswo
45
44
  toRemove.push('password');
46
45
  if (optionalFields && !optionalFields.includes('birth_date'))
47
46
  toRemove.push('birth_date');
48
- if (optionalFields && !optionalFields.includes('gender'))
49
- toRemove.push('gender');
50
47
  const allFields = [
51
48
  {
52
49
  label: 'First Name',
@@ -86,13 +83,6 @@ const useSignUpForm = (loading, error, signUp, callback, checkConfig, hidePasswo
86
83
  name: 'birth_date',
87
84
  type: 'tel',
88
85
  required: hasPunchh
89
- },
90
- {
91
- label: 'Gender',
92
- name: 'gender',
93
- type: 'select',
94
- showLabel: true,
95
- options: useProfileForm_1.genderOptions
96
86
  }
97
87
  ];
98
88
  const fields = allFields.filter(i => !toRemove.includes(i.name));
@@ -11,7 +11,6 @@ exports.profileFields = [
11
11
  'phone',
12
12
  'company',
13
13
  'birth_date',
14
- 'gender',
15
14
  'is_verified',
16
15
  'is_notification_set'
17
16
  ];
@@ -1,9 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Customer, CustomerCreate, FormFieldType, Gender, RequestError, RequestStatus } from '@open-tender/types';
3
- export declare const genderOptions: {
4
- name: string;
5
- value: Gender;
6
- }[];
2
+ import { Customer, CustomerCreate, FormFieldType, RequestError, RequestStatus } from '@open-tender/types';
7
3
  export declare const useProfileForm: (profile: Customer | null, loading: RequestStatus, error: RequestError, update: (data: CustomerCreate) => void, callback?: ((data: CustomerCreate) => void) | undefined, optionalFields?: string[]) => {
8
4
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
9
5
  data: Customer | null;
@@ -1,10 +1,5 @@
1
1
  import { useRef, useState, useEffect, useMemo } from 'react';
2
2
  import { makeBirthDate, makeFormErrors, makePhone, slashesToDashes } from '../utils';
3
- export const genderOptions = [
4
- { name: 'not specified', value: 'DECLINED' },
5
- { name: 'Male', value: 'MALE' },
6
- { name: 'Female', value: 'FEMALE' }
7
- ];
8
3
  const allFields = [
9
4
  { label: 'First Name', name: 'first_name', type: 'text', required: true },
10
5
  { label: 'Last Name', name: 'last_name', type: 'text', required: true },
@@ -17,21 +12,13 @@ const allFields = [
17
12
  },
18
13
  { label: 'Phone', name: 'phone', type: 'tel', required: true },
19
14
  { label: 'Company', name: 'company', type: 'text' },
20
- { label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
21
- {
22
- label: 'Gender',
23
- name: 'gender',
24
- type: 'select',
25
- showLabel: true,
26
- options: genderOptions
27
- }
15
+ { label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' }
28
16
  ];
29
17
  const makePayload = (fields, data) => {
30
18
  if (!data)
31
19
  return null;
32
20
  const rest = fields.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i.name]: data[i.name] })), {});
33
21
  rest.birth_date = data.birth_date ? slashesToDashes(data.birth_date) : null;
34
- rest.gender = data.gender || null;
35
22
  return rest;
36
23
  };
37
24
  export const useProfileForm = (profile, loading, error, update, callback, optionalFields) => {
@@ -43,8 +30,6 @@ export const useProfileForm = (profile, loading, error, update, callback, option
43
30
  const removed = [];
44
31
  if (optionalFields && !optionalFields.includes('birth_date'))
45
32
  removed.push('birth_date');
46
- if (optionalFields && !optionalFields.includes('gender'))
47
- removed.push('gender');
48
33
  return removed;
49
34
  }, [optionalFields]);
50
35
  // const fields = allFields.filter((i) => !toRemove.includes(i.name))
@@ -1,6 +1,5 @@
1
1
  import { useRef, useState, useEffect } from 'react';
2
2
  import { makeBirthDate, makeFormErrors, makePhone, slashesToDashes } from '../utils';
3
- import { genderOptions } from './useProfileForm';
4
3
  const initState = {
5
4
  first_name: '',
6
5
  last_name: '',
@@ -42,8 +41,6 @@ export const useSignUpForm = (loading, error, signUp, callback, checkConfig, hid
42
41
  toRemove.push('password');
43
42
  if (optionalFields && !optionalFields.includes('birth_date'))
44
43
  toRemove.push('birth_date');
45
- if (optionalFields && !optionalFields.includes('gender'))
46
- toRemove.push('gender');
47
44
  const allFields = [
48
45
  {
49
46
  label: 'First Name',
@@ -83,13 +80,6 @@ export const useSignUpForm = (loading, error, signUp, callback, checkConfig, hid
83
80
  name: 'birth_date',
84
81
  type: 'tel',
85
82
  required: hasPunchh
86
- },
87
- {
88
- label: 'Gender',
89
- name: 'gender',
90
- type: 'select',
91
- showLabel: true,
92
- options: genderOptions
93
83
  }
94
84
  ];
95
85
  const fields = allFields.filter(i => !toRemove.includes(i.name));
@@ -8,7 +8,6 @@ export const profileFields = [
8
8
  'phone',
9
9
  'company',
10
10
  'birth_date',
11
- 'gender',
12
11
  'is_verified',
13
12
  'is_notification_set'
14
13
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.44",
3
+ "version": "0.4.45",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -36,7 +36,6 @@
36
36
  "private": false,
37
37
  "devDependencies": {
38
38
  "@emotion/react": "^11.10.4",
39
- "@open-tender/types": "^0.4.59",
40
39
  "@reduxjs/toolkit": "^1.8.5",
41
40
  "@types/google.maps": "^3.53.5",
42
41
  "@types/jest": "^29.5.11",
@@ -58,7 +57,7 @@
58
57
  "typescript": "^4.8.2"
59
58
  },
60
59
  "peerDependencies": {
61
- "@open-tender/types": "^0.4.59",
60
+ "@open-tender/types": "^0.4.70",
62
61
  "@reduxjs/toolkit": "^1.8.5",
63
62
  "react": "^18.2.0"
64
63
  },