@builtbystack/sq-shopify-theme-sdk 0.0.19 → 0.0.20
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/README.doc.md +7 -0
- package/README.md +17 -0
- package/dist/sq-shopify-theme-sdk.d.ts +10 -0
- package/dist/sq-shopify-theme-sdk.js +1 -0
- package/dist/sq-shopify-theme-sdk.umd.js +1 -1
- package/package.json +2 -4
package/README.doc.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
`@x.x.x` で指定されているバージョンは適宜最新のものを利用してください。
|
|
6
6
|
|
|
7
|
+
SDKは名前空間 `SQ` 内に存在するため、SDKの初期化は `new SQ.SDK()` で行ってください。
|
|
8
|
+
|
|
7
9
|
```html
|
|
8
10
|
<script src="https://unpkg.com/@builtbystack/sq-shopify-theme-sdk@x.x.x/dist/sq-shopify-theme-sdk.umd.js" defer></script>
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
window.onload = async () => {
|
|
13
|
+
const sdk = new SQ.SDK({{ request.origin | json }});
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
9
16
|
```
|
package/README.md
CHANGED
|
@@ -11,8 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
`@x.x.x` で指定されているバージョンは適宜最新のものを利用してください。
|
|
13
13
|
|
|
14
|
+
SDKは名前空間 `SQ` 内に存在するため、SDKの初期化は `new SQ.SDK()` で行ってください。
|
|
15
|
+
|
|
14
16
|
```html
|
|
15
17
|
<script src="https://unpkg.com/@builtbystack/sq-shopify-theme-sdk@x.x.x/dist/sq-shopify-theme-sdk.umd.js" defer></script>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
window.onload = async () => {
|
|
20
|
+
const sdk = new SQ.SDK({{ request.origin | json }});
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
16
23
|
```
|
|
17
24
|
|
|
18
25
|
# Classes
|
|
@@ -982,6 +989,12 @@ Product は商品情報を表す。
|
|
|
982
989
|
|
|
983
990
|
### Type declaration
|
|
984
991
|
|
|
992
|
+
#### hasBackOrderProductVariants
|
|
993
|
+
|
|
994
|
+
> **hasBackOrderProductVariants**: `boolean`
|
|
995
|
+
|
|
996
|
+
商品が持つバリエーションに1つでも予約販売設定がされている場合trueが返る
|
|
997
|
+
|
|
985
998
|
#### id
|
|
986
999
|
|
|
987
1000
|
> **id**: `string`
|
|
@@ -990,10 +1003,14 @@ Product は商品情報を表す。
|
|
|
990
1003
|
|
|
991
1004
|
> **title**: `string`
|
|
992
1005
|
|
|
1006
|
+
商品のタイトル
|
|
1007
|
+
|
|
993
1008
|
#### variants
|
|
994
1009
|
|
|
995
1010
|
> **variants**: [`ProductVariants`](#type-aliasesproductvariantsmd)
|
|
996
1011
|
|
|
1012
|
+
商品のバリエーション一覧
|
|
1013
|
+
|
|
997
1014
|
|
|
998
1015
|
<a name="type-aliasesproductvariantmd"></a>
|
|
999
1016
|
|
|
@@ -265,7 +265,17 @@ export declare type Points = {
|
|
|
265
265
|
*/
|
|
266
266
|
export declare type Product = {
|
|
267
267
|
id: string;
|
|
268
|
+
/**
|
|
269
|
+
* 商品のタイトル
|
|
270
|
+
*/
|
|
268
271
|
title: string;
|
|
272
|
+
/**
|
|
273
|
+
* 商品が持つバリエーションに1つでも予約販売設定がされている場合trueが返る
|
|
274
|
+
*/
|
|
275
|
+
hasBackOrderProductVariants: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* 商品のバリエーション一覧
|
|
278
|
+
*/
|
|
269
279
|
variants: ProductVariants;
|
|
270
280
|
};
|
|
271
281
|
|
|
@@ -3822,6 +3822,7 @@ class vn {
|
|
|
3822
3822
|
return o.productByProductShopifyLegacyResourceID ? {
|
|
3823
3823
|
id: o.productByProductShopifyLegacyResourceID.id,
|
|
3824
3824
|
title: o.productByProductShopifyLegacyResourceID.title,
|
|
3825
|
+
hasBackOrderProductVariants: o.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,
|
|
3825
3826
|
variants: {
|
|
3826
3827
|
nodes: o.productByProductShopifyLegacyResourceID.productVariants.nodes.map(
|
|
3827
3828
|
(c) => ({
|
|
@@ -376,4 +376,4 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
`,pn=(e,t,n,r)=>e();function fn(e,t=pn){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(an,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)},GetSharingPurchasingCustomerCount(n,r){return t(i=>e.request(un,n,{...r,...i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r){return t(i=>e.request(cn,n,{...r,...i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r){return t(i=>e.request(ln,n,{...r,...i}),"GetProduct","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r){return t(i=>e.request(dn,n,{...r,...i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r){return t(i=>e.request(hn,n,{...r,...i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)}}}class mn{constructor(t){Ge(this,"api");this.api=fn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,mapURL:o.location.mapURL,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:r.locationAvailability.location.id,name:r.locationAvailability.location.name,phone:r.locationAvailability.location.phone,mapURL:r.locationAvailability.location.mapURL,address:r.locationAvailability.location.address?{id:r.locationAvailability.location.address.id,countryCode:r.locationAvailability.location.address.countryCode,country:r.locationAvailability.location.address.country,postalCode:r.locationAvailability.location.address.postalCode,provinceCode:r.locationAvailability.location.address.provinceCode,province:r.locationAvailability.location.address.province,city:r.locationAvailability.location.address.city,address1:r.locationAvailability.location.address.address1,address2:r.locationAvailability.location.address.address2}:void 0},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name,phone:s.phone,mapURL:s.mapURL,address:s.address?{id:s.address.id,countryCode:s.address.countryCode,country:s.address.country,postalCode:s.address.postalCode,provinceCode:s.address.provinceCode,province:s.address.province,city:s.address.city,address1:s.address.address1,address2:s.address.address2}:void 0}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.orderPriceAdjustmentRules.nodes.map(s=>({id:s.id,title:s.title,status:s.status,description:s.description,code:s.code,customerApplicable:s.customerApplicable,shopifyStoreApplicable:s.shopifyStoreApplicable,applicableLocationCount:s.applicableLocationCount,hasApplicableLocations:s.hasApplicableLocations,startsAt:new Date(s.startsAt),endsAt:new Date(s.endsAt),createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.orderPriceAdjustmentRules.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),tenant:{id:o.pointChange.tenant.id,name:o.pointChange.tenant.name},createdAt:new Date(o.pointChange.createdAt)},retailLocation:o.retailLocation?{id:o.retailLocation.id,name:o.retailLocation.name,phone:o.retailLocation.phone,mapURL:o.retailLocation.mapURL,address:o.retailLocation.address?{id:o.retailLocation.address.id,countryCode:o.retailLocation.address.countryCode,country:o.retailLocation.address.country,postalCode:o.retailLocation.address.postalCode,provinceCode:o.retailLocation.address.provinceCode,province:o.retailLocation.address.province,city:o.retailLocation.address.city,address1:o.retailLocation.address.address1,address2:o.retailLocation.address.address2}:void 0}:void 0,tenant:{id:o.tenant.id,name:o.tenant.name}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}async getPurchasingCustomerDiscountCodeCount(){var n;return((n=(await this.api.GetPurchasingCustomerDiscountCodeCount()).purchasingCustomer)==null?void 0:n.orderPriceAdjustmentRuleCount)??0}async getSharingPurchasingCustomerCount(){var n;return((n=(await this.api.GetSharingPurchasingCustomerCount()).purchasingCustomer)==null?void 0:n.sharingPurchasingCustomerCount)??0}async getPurchasingCustomerSharing(){var n;const t=await this.api.GetPurchasingCustomerSharing();return(n=t.purchasingCustomer)!=null&&n.customerSharing?{id:t.purchasingCustomer.customerSharing.id,purchasingCustomers:t.purchasingCustomer.customerSharing.purchasingCustomers.map(r=>({id:r.id,sharingPurchasingCustomerCount:r.sharingPurchasingCustomerCount,tenant:{id:r.tenant.id,name:r.tenant.name}}))}:null}async getProduct(t,n,r,i,s){const o=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return o.productByProductShopifyLegacyResourceID?{id:o.productByProductShopifyLegacyResourceID.id,title:o.productByProductShopifyLegacyResourceID.title,variants:{nodes:o.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,isBackOrderEnable:c.isBackOrderEnable,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku}})),pageInfo:o.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async purchasingCustomerSendCustomerSharingActivationCode(){const t=await this.api.PurchasingCustomerSendCustomerSharingActivationCode();return t.purchasingCustomerSendCustomerSharingActivationCode?{purchasingCustomer:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.id,sharingPurchasingCustomerCount:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.id,name:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.name}},customerSharingActivationCodeID:t.purchasingCustomerSendCustomerSharingActivationCode.customerSharingActivationCode.id}:null}async purchasingCustomerActivateCustomerSharing(t,n){if(n.length!==6)throw new Error(`Invalid activation code: ${n} is not 6 characters.`);const r=await this.api.PurchasingCustomerActivateCustomerSharing({email:t,activationCode:n});return r.purchasingCustomerActivateCustomerSharing?{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.id,sharingPurchasingCustomerCount:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.id,name:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.name}}:null}}_.SDK=mn,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
379
|
+
`,pn=(e,t,n,r)=>e();function fn(e,t=pn){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerDiscountCodeCount(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerDiscountCodeCount","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(an,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)},GetSharingPurchasingCustomerCount(n,r){return t(i=>e.request(un,n,{...r,...i}),"GetSharingPurchasingCustomerCount","query",n)},GetPurchasingCustomerSharing(n,r){return t(i=>e.request(cn,n,{...r,...i}),"GetPurchasingCustomerSharing","query",n)},GetProduct(n,r){return t(i=>e.request(ln,n,{...r,...i}),"GetProduct","query",n)},PurchasingCustomerSendCustomerSharingActivationCode(n,r){return t(i=>e.request(dn,n,{...r,...i}),"PurchasingCustomerSendCustomerSharingActivationCode","mutation",n)},PurchasingCustomerActivateCustomerSharing(n,r){return t(i=>e.request(hn,n,{...r,...i}),"PurchasingCustomerActivateCustomerSharing","mutation",n)}}}class mn{constructor(t){Ge(this,"api");this.api=fn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,mapURL:o.location.mapURL,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:r.locationAvailability.location.id,name:r.locationAvailability.location.name,phone:r.locationAvailability.location.phone,mapURL:r.locationAvailability.location.mapURL,address:r.locationAvailability.location.address?{id:r.locationAvailability.location.address.id,countryCode:r.locationAvailability.location.address.countryCode,country:r.locationAvailability.location.address.country,postalCode:r.locationAvailability.location.address.postalCode,provinceCode:r.locationAvailability.location.address.provinceCode,province:r.locationAvailability.location.address.province,city:r.locationAvailability.location.address.city,address1:r.locationAvailability.location.address.address1,address2:r.locationAvailability.location.address.address2}:void 0},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name,phone:s.phone,mapURL:s.mapURL,address:s.address?{id:s.address.id,countryCode:s.address.countryCode,country:s.address.country,postalCode:s.address.postalCode,provinceCode:s.address.provinceCode,province:s.address.province,city:s.address.city,address1:s.address.address1,address2:s.address.address2}:void 0}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.orderPriceAdjustmentRules.nodes.map(s=>({id:s.id,title:s.title,status:s.status,description:s.description,code:s.code,customerApplicable:s.customerApplicable,shopifyStoreApplicable:s.shopifyStoreApplicable,applicableLocationCount:s.applicableLocationCount,hasApplicableLocations:s.hasApplicableLocations,startsAt:new Date(s.startsAt),endsAt:new Date(s.endsAt),createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.orderPriceAdjustmentRules.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),tenant:{id:o.pointChange.tenant.id,name:o.pointChange.tenant.name},createdAt:new Date(o.pointChange.createdAt)},retailLocation:o.retailLocation?{id:o.retailLocation.id,name:o.retailLocation.name,phone:o.retailLocation.phone,mapURL:o.retailLocation.mapURL,address:o.retailLocation.address?{id:o.retailLocation.address.id,countryCode:o.retailLocation.address.countryCode,country:o.retailLocation.address.country,postalCode:o.retailLocation.address.postalCode,provinceCode:o.retailLocation.address.provinceCode,province:o.retailLocation.address.province,city:o.retailLocation.address.city,address1:o.retailLocation.address.address1,address2:o.retailLocation.address.address2}:void 0}:void 0,tenant:{id:o.tenant.id,name:o.tenant.name}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}async getPurchasingCustomerDiscountCodeCount(){var n;return((n=(await this.api.GetPurchasingCustomerDiscountCodeCount()).purchasingCustomer)==null?void 0:n.orderPriceAdjustmentRuleCount)??0}async getSharingPurchasingCustomerCount(){var n;return((n=(await this.api.GetSharingPurchasingCustomerCount()).purchasingCustomer)==null?void 0:n.sharingPurchasingCustomerCount)??0}async getPurchasingCustomerSharing(){var n;const t=await this.api.GetPurchasingCustomerSharing();return(n=t.purchasingCustomer)!=null&&n.customerSharing?{id:t.purchasingCustomer.customerSharing.id,purchasingCustomers:t.purchasingCustomer.customerSharing.purchasingCustomers.map(r=>({id:r.id,sharingPurchasingCustomerCount:r.sharingPurchasingCustomerCount,tenant:{id:r.tenant.id,name:r.tenant.name}}))}:null}async getProduct(t,n,r,i,s){const o=await this.api.GetProduct({id:t,first:n,after:r,isReverse:i,sortKeys:s});return o.productByProductShopifyLegacyResourceID?{id:o.productByProductShopifyLegacyResourceID.id,title:o.productByProductShopifyLegacyResourceID.title,hasBackOrderProductVariants:o.productByProductShopifyLegacyResourceID.hasBackOrderProductVariants,variants:{nodes:o.productByProductShopifyLegacyResourceID.productVariants.nodes.map(c=>({id:c.id,title:c.title,isBackOrderEnable:c.isBackOrderEnable,inventoryItem:{id:c.inventoryItem.id,sku:c.inventoryItem.sku}})),pageInfo:o.productByProductShopifyLegacyResourceID.productVariants.pageInfo}}:null}async purchasingCustomerSendCustomerSharingActivationCode(){const t=await this.api.PurchasingCustomerSendCustomerSharingActivationCode();return t.purchasingCustomerSendCustomerSharingActivationCode?{purchasingCustomer:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.id,sharingPurchasingCustomerCount:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.id,name:t.purchasingCustomerSendCustomerSharingActivationCode.purchasingCustomer.tenant.name}},customerSharingActivationCodeID:t.purchasingCustomerSendCustomerSharingActivationCode.customerSharingActivationCode.id}:null}async purchasingCustomerActivateCustomerSharing(t,n){if(n.length!==6)throw new Error(`Invalid activation code: ${n} is not 6 characters.`);const r=await this.api.PurchasingCustomerActivateCustomerSharing({email:t,activationCode:n});return r.purchasingCustomerActivateCustomerSharing?{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.id,sharingPurchasingCustomerCount:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.sharingPurchasingCustomerCount,tenant:{id:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.id,name:r.purchasingCustomerActivateCustomerSharing.purchasingCustomer.tenant.name}}:null}}_.SDK=mn,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED